Click here to Skip to main content
13,094,742 members (82,731 online)
Click here to Skip to main content
Add your own
alternative version


39 bookmarked
Posted 10 Jul 2001

Adding your application to the Windows Startup

, 10 Jul 2001
Rate this:
Please Sign up or sign in to vote.
An article on including an application in the Windows startup list
<!-- Download Links --> <!-- Main HTML starts here -->


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


About the Author

Architect VisionOne AG
Switzerland Switzerland
XicoLoko is a brazilian developer based in Switzerland.

You may also be interested in...


Comments and Discussions

GeneralThank you Pin
quangson200210-Nov-07 15:35
memberquangson200210-Nov-07 15:35 
GeneralThanks Pin
vinnubhai_M_C_S13-Apr-05 1:11
membervinnubhai_M_C_S13-Apr-05 1:11 
Generali did't me... Pin
srinu_gari2-Oct-02 20:31
susssrinu_gari2-Oct-02 20:31 
Questionanother way? Pin
rebel28-Mar-02 3:16
memberrebel28-Mar-02 3:16 
AnswerRe: another way? Pin
KarstenK21-May-02 22:20
memberKarstenK21-May-02 22:20 
GeneralHelp for Run as Service or Application Pin
Norman Bates14-Jul-01 5:06
memberNorman Bates14-Jul-01 5:06 
QuestionWill it start before the password window? Pin
Crocmort12-Jul-01 9:05
memberCrocmort12-Jul-01 9:05 
AnswerRe: Will it start before the password window? Pin
Ed Dixon12-Jul-01 10:57
memberEd Dixon12-Jul-01 10:57 
GeneralRe: Will it start before the password window? Pin
Crocmort12-Jul-01 11:48
memberCrocmort12-Jul-01 11:48 
GeneralRe: Will it start before the password window? Pin
Ed Dixon12-Jul-01 12:07
memberEd Dixon12-Jul-01 12:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170813.1 | Last Updated 11 Jul 2001
Article Copyright 2001 by xicoloko
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid