Click here to Skip to main content
Licence 
First Posted 10 Jul 2001
Views 76,779
Bookmarked 33 times

Adding your application to the Windows Startup

By | 10 Jul 2001 | Article
An article on including an application in the Windows startup list

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

About the Author

xicoloko

Architect
VisionOne AG
Switzerland Switzerland

Member

XicoLoko is a brazilian developer based in Switzerland.


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralThank you Pinmemberquangson200215:35 10 Nov '07  
GeneralThanks Pinmembervinnubhai_M_C_S1:11 13 Apr '05  
Generali did't work....help me... Pinsusssrinu_gari20:31 2 Oct '02  
Questionanother way? Pinmemberrebel3:16 28 Mar '02  
AnswerRe: another way? PinmemberKarstenK22:20 21 May '02  
GeneralHelp for Run as Service or Application PinmemberNorman Bates5:06 14 Jul '01  
QuestionWill it start before the password window? PinmemberCrocmort9:05 12 Jul '01  
AnswerRe: Will it start before the password window? PinmemberEd Dixon10:57 12 Jul '01  
GeneralRe: Will it start before the password window? PinmemberCrocmort11:48 12 Jul '01  
GeneralRe: Will it start before the password window? PinmemberEd Dixon12:07 12 Jul '01  

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.

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