When windows logs in it starts so many program's that are crucial but also so many extra program's that the user installs such as Skype, you have an option to start Skype on login. Anything that starts on login is in a menu under system configuration (search in start menu) in a tab called startup... How do I as my program to this menu and automatically enable?
Use the registry API. All I know off the top of my head is you need to open the key, add the value, and then close the key. The function names should be obvious if you look at the reference page:
You may also be able to add it directly to the Start Menu using
the shgetknownfolderpath function to get the Start Menu folder and adding it directly to the StartUP folder.
Thanks, the MSDN looks like it could have some good stuff (don't know why I didn't think of that)
Now just to figure out what functions to use and how the hell to string them together!?
Right I think I need to create a new directory for my program and then what-ever data it needs to link to the program in this registry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
Don't suppose someone could double check that to make sure it's safe to edit this and add my own program in there?
And I think I start doing this by using:
1 2 3 4 5 6 7
RegOpenKeyEx(
HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Run",
0,
KEY_WRITE,
//I don't know how to setup this final argument, tbh I don't know what a handle is.
);
http://msdn.microsoft.com/en-us/library/ms724837(v=vs.85).aspx
Looking at other programs such as daemon tools or skype I need to add a string variable with my program path but there are certain arguments that need to come after this such as in skype it shows "/minimised /regrun" and in daemon tools it shows "-autorun"
That additional stuff for skype and daemon tools are command line parameters. "/minimize" and "-autorun" probably tell the respective programs to run in the background.
@AHCFan20
So when the system runs the programs in the "Run" key it's like opening the programs through cmd and typing "/minimize" after the program, to send it to main(sting arg[])?
@modoran
Thanks for the info, just checked what the arguments on RegSetValueEx(//args) do, Most of it seems to make sense to me... Cheers XD
So when the system runs the programs in the "Run" key it's like opening the programs through cmd and typing "/minimize" after the program, to send it to main(sting arg[])?
That's right. Every process has a command line regardless of how it is executed.
This is pretty much solved then (I'll just lookup how to remove which I'm fairly certain should be quite similar)...
But since it's linked in, does anybody know the name of the directory or registry which is used for windows program list? (i.e. The big list of programs under the "edit or remove programs" from windows control panel)