vik*_*kas 0 c# registry windows-api-code-pack
我有一个Windows窗体应用程序的维护工作,其中包含窗体的Form_Load方法上的Windows RegistryKey代码.但我不知道是什么工作正在由RegistryKey代码片段执行.这是我的代码令我困惑的是..
try
{
RegistryKey rkStartUp = Registry.LocalMachine;
RegistryKey StartupPath;
StartupPath = rkStartUp.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
if (StartupPath.GetValue("ABCDXYZ") == null)
{
StartupPath.SetValue("ABCDXYZ", Application.ExecutablePath, RegistryValueKind.ExpandString);
}
}
catch
{
}
Run Code Online (Sandbox Code Playgroud)
任何帮助解释它将受到高度赞赏.
此代码只是在注释中执行
//gets the local machine registry settings
RegistryKey rkStartUp = Registry.LocalMachine;
RegistryKey StartupPath;
//opens the registry key in which all the windows startup applications are configured
StartupPath = rkStartUp.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
//checks if ABDXYZ application is in startup settings, if not exists as startup //app
if (StartupPath.GetValue("ABCDXYZ") == null)
{
//adds the startup app for ABCDXYZ, so that this application will start when windeos starts
//next time
StartupPath.SetValue("ABCDXYZ", Application.ExecutablePath, RegistryValueKind.ExpandString);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
345 次 |
| 最近记录: |