[英]WPF - remove application auto run after startup
So i using this code to add Key registry
to automatically open my application on startup: 因此,我使用此代码添加
Key registry
以在启动时自动打开我的应用程序:
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
Assembly curAssembly = Assembly.GetExecutingAssembly();
key.SetValue(curAssembly.GetName().Name, curAssembly.Location);
So now i want to be able to remove this option in order to add this to m application user define so i search for RemoveKey
on something similar. 因此,现在我希望能够删除此选项,以便将其添加到应用程序用户定义中,以便在类似的
RemoveKey
上搜索RemoveKey
。
Any suggestions ? 有什么建议么 ?
使用DeleteValue()方法:
key.DeleteValue(curAssembly.GetName().Name);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.