I have a C# Windows Form Application 开发者_C百科that has settings, in the settings window I'll have a check box witch indicates that my application should start automatically after windows start-up or not. I need to set and unset this future programmatically in c#. What is the simplest way to do this ?
To auto-run your program at windows startup you want to add your application to the registry key at:
hkcu\Software\Microsoft\Windows\CurrentVersion\Run
There will be other keys there; take a look in regedit to see examples of what yours needs to look like.
You can add or remove a key there with the registry class:
http://msdn.microsoft.com/en-us/library/h5e7chcf.aspx
one option would be http://simpcode.blogspot.com/2008/07/c-set-and-unset-auto-start-for-windows.html
精彩评论