Today I accidentally saw an article with a modified note table. Article In my mind, I thought about whether C # could modify the notebooks table, so I found some articles on the Internet.
Although I learned a lot, I made another step!
First, let's take a look at the C # Operation Note sequence table types.
(1). Registry class: This class encapsulates seven public static domains, which represent the seven basic primary keys in the Windows Registry respectively, as shown below:
Registry. classesroot corresponds to the hkey_classes_root primary key
Registry. currentuser corresponds to the HKEY_CURRENT_USER primary key
Registry. localmachine corresponds to the HKEY_LOCAL_MACHINE primary key
Registry. User corresponds to the hkey_user primary key
Registry. currentconfig corresponds to the primary key of heky_current_config
Registry. dynda corresponds to the hkey_dyn_data primary key
Registry. performancedata corresponds to the hkey_performance_data primary key.
(2). registrykey class: This class encapsulates basic operations on the Windows registry. InProgramIn the design, first find the basic primary key in the registry through the registry class, and then use the registrykey class to find the subkey and process the specific operation.
Generation: Using Microsoft. Win32;
/// <Summary>
/// Obtain the value in the "NOTE" table.
/// </Summary>
/// <Returns> </returns>
Private String Getregistdata ()
{
String Registdata;
Registrykey hkml = Registry. localmachine;
Registrykey rootfolder = Registry. localmachine;
Registrykey System = Rootfolder. opensubkey ( " System " , True );
Registrykey CurrentControlSet = System. opensubkey ( " CurrentControlSet " , True );
Registrykey services = CurrentControlSet. opensubkey ( " Services " , True );
Registrykey TCPIP = Services. opensubkey ( " Tcpip " , True );
Registrykey Parameters = Tcpip. opensubkey ( " Parameters " , True );
Registrykey netcardid = Parameters. opensubkey ( " WinSock " , True );
Registdata = Netcardid. getvalue ( " Helperdllname " , " Null " ). Tostring ();
Return Registdata;
}
/// <Summary>
/// Values of the sequence table
/// In this example, create a project named XX, and set the project name to XXX and the value to test.
/// </Summary>
Private Void Createregistdata ()
{
Registrykey hkml = Registry. localmachine;
Registrykey rootfolder = Registry. localmachine;
Registrykey System = Rootfolder. opensubkey ( " System " , True );
Registrykey CurrentControlSet = System. opensubkey ( " CurrentControlSet " , True );
Registrykey services = CurrentControlSet. opensubkey ( " Services " , True );
Registrykey TCPIP = Services. opensubkey ( " Tcpip " , True );
Registrykey Parameters = Tcpip. opensubkey ( " Parameters " , True );
Registrykey netcardid = Parameters. opensubkey ( " WinSock " , True );
Registrykey xxx = Netcardid. createsubkey ( " Xxx " );
// 384 is in hexadecimal notation, and DWORD is in hexadecimal notation. The system will perform automatic importing. The most efficient way is to import the hexadecimal notation of 180,180 to 384.
Xxx. setvalue ( " Xxx " , 384 , Registryvaluekind. DWORD );
}
/// <Summary>
/// Except the cursor
/// </Summary>
Private Void Deletevalueregistdata ()
{
Registrykey hkml = Registry. localmachine;
Registrykey rootfolder = Registry. localmachine;
Registrykey System = Rootfolder. opensubkey ( " System " , True );
Registrykey CurrentControlSet = System. opensubkey ( " CurrentControlSet " , True );
Registrykey services = CurrentControlSet. opensubkey ( " Services " , True );
Registrykey TCPIP = Services. opensubkey ( " Tcpip " , True );
Registrykey Parameters = Tcpip. opensubkey ( " Parameters " , True );
Registrykey netcardid = Parameters. opensubkey ( " WinSock " , True );
Registrykey xxx = Netcardid. opensubkey ( " Xxx " , True );
String [] Subvalue;
Subvalue = Xxx. getvaluenames ();
Foreach ( String Ssubvalue In Subvalue)
{
If (Ssubvalue = " Xxx " )
{
Xxx. deletevalue (ssubvalue );
}
}
}
/// <Summary>
/// Remove Sub-Projects
/// </Summary>
Private Void Deletesubregistdata ()
{
Registrykey hkml = Registry. localmachine;
Registrykey rootfolder = Registry. localmachine;
Registrykey System = Rootfolder. opensubkey ( " System " , True );
Registrykey CurrentControlSet = System. opensubkey ( " CurrentControlSet " , True );
Registrykey services = CurrentControlSet. opensubkey ( " Services " , True );
Registrykey TCPIP = Services. opensubkey ( " Tcpip " , True );
Registrykey Parameters = Tcpip. opensubkey ( " Parameters " , True );
Registrykey netcardid = Parameters. opensubkey ( " WinSock " , True );
String [] Subvalue;
Subvalue = Netcardid. getsubkeynames ();
Foreach ( String Ssubvalue In Subvalue)
{
If (Ssubvalue = " Xxx " )
{
Netcardid. deletesubkey (ssubvalue );
}
}
}