![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
Q: Tell Windows to run a program during startupAnswerEither place a shortcut to your program in the Windows startup folder, or add an entry to the registry for your program. If you want to use the shortcut technique, then take a look at the FAQ on how to create a shortcut on the desktop. You can use the same code from that FAQ. Instead of saving the shortcut to the desktop directory, save it to the startup directory. You can find the startup directory by calling SHGetSpecialFolderLocation and passing it the CSIDL_STARTUP flag. If you prefer to use the registry, then you need to create a new entry for your program in the HKEY_LOCAL_MACHINE/Software/Microsoft/Windows/CurrentVersion/Run registry folder. Windows will launch every program that is in this folder when the OS boots. Your registry entry should be a string value. The name of the entry should be distinctive and unique from the other entries in the Run folder. The string value should be the full path to the executable. The registry has a couple of other folders that are similar ot the Run folder. The RunOnce folder contains programs that will execute the next time the OS boots. After that, they are removed from the registry. RunOnce works well for registration reminder programs. RunServices and RunServicesOnce allow you to launch a program before the OS boots. Virus scanners often make use of the RunServices folder. | ||||||
All rights reserved. |