Introduction
Sometimes you want to make you application run everytime Windows starts up. One approach is to develop a service, but it will
work just in NT or 2K boxes. To make it happen in Win95/98 boxes is necessary to change the registry settings.
The registry key is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run to all users and
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run to the current user.
To make this task easier I wrote a wrapper class (CWinStartup) that adds and removes applications from the startup
bool AddApp(HINSTANCE hInst, LPCTSTR lpszName, StartupUser user) |
Add an app to the startup through the HINSTANCE |
bool AddApp(LPCTSTR lpszName, LPCTSTR lpszPath, StartupUser user) |
Add the app according to the path defined |
bool RemoveApp(LPCTSTR lpszName, StartupUser user) |
Removes the app from the registry |
All the methods are static. This class has been tested on Win2K boxes only, but as far as I'm concerned
it works in all Windows versions.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here