Click here to Skip to main content
Click here to Skip to main content

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 -->

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.

License

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

Share

About the Author

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

Comments and Discussions

 
QuestionWill it start before the password window? PinmemberCrocmort12-Jul-01 10:05 
AnswerRe: Will it start before the password window? PinmemberEd Dixon12-Jul-01 11:57 
GeneralRe: Will it start before the password window? PinmemberCrocmort12-Jul-01 12:48 
GeneralRe: Will it start before the password window? PinmemberEd Dixon12-Jul-01 13:07 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.1411023.1 | Last Updated 11 Jul 2001
Article Copyright 2001 by xicoloko
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid