Running an application automaticaly
-
Hello. Anyone here knows how to edit the registry of Windows XP so that one of my application can run automatically once windows startup? Im doing this for one of my final thesis project. Also, is there any options so that i can run the application background (hidden). My application doesnt have any GUI. Its just a win32 console application.
-
Hello. Anyone here knows how to edit the registry of Windows XP so that one of my application can run automatically once windows startup? Im doing this for one of my final thesis project. Also, is there any options so that i can run the application background (hidden). My application doesnt have any GUI. Its just a win32 console application.
There are a few different ways to make programs start with windows: 1. Registry 2. Startup folder 3. Service (can run before login) Depending on what you program does some methods may be better then others, for example if you have a computer critical driver then a service is nice. If its a utility which no one would want to disable the registry is nice, and if its a ad-don which someone might want to disable, then the startup folder is nice. 1. Registry: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run There are different places as you see, and if i remember correctly you can add it HKEY_LOCAL_MACHINE for it to start with all users or HKEY_CURRENT_USER for currently logged on user (but not sure) 2. Startup: C:\Documents and Settings\All Users\Start Menu\Programs\Startup C:\Documents and Settings\%USERNAME%\Start Menu\Programs\Startup This also has a per user setting, or global. Its a nice and very simple 3. Service: Services are the most reliable and most advanced, they can run before the user logs in, and keeps running when all users have logged out. If your application has no dialogs, then it shouldnt show anything no-matter how it starts, but if you use the registry or services (maybe even startup folder) then you can pass you own params to affect how your program starts. (but you will have to program them..) Choose which method would fit best to you application, then Google a bit on it, there is alot of info for all of them :)
//Johannes
-
There are a few different ways to make programs start with windows: 1. Registry 2. Startup folder 3. Service (can run before login) Depending on what you program does some methods may be better then others, for example if you have a computer critical driver then a service is nice. If its a utility which no one would want to disable the registry is nice, and if its a ad-don which someone might want to disable, then the startup folder is nice. 1. Registry: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run There are different places as you see, and if i remember correctly you can add it HKEY_LOCAL_MACHINE for it to start with all users or HKEY_CURRENT_USER for currently logged on user (but not sure) 2. Startup: C:\Documents and Settings\All Users\Start Menu\Programs\Startup C:\Documents and Settings\%USERNAME%\Start Menu\Programs\Startup This also has a per user setting, or global. Its a nice and very simple 3. Service: Services are the most reliable and most advanced, they can run before the user logs in, and keeps running when all users have logged out. If your application has no dialogs, then it shouldnt show anything no-matter how it starts, but if you use the registry or services (maybe even startup folder) then you can pass you own params to affect how your program starts. (but you will have to program them..) Choose which method would fit best to you application, then Google a bit on it, there is alot of info for all of them :)
//Johannes
So u mean that just add a new string value initiating the path of my application in the regedit to both HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run and the program will run automatically after startup? I think adding the registry would be the best choice since i dont want the user to disable my application. Anyway, thanks a lot. Really appreciate it.
-
So u mean that just add a new string value initiating the path of my application in the regedit to both HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run and the program will run automatically after startup? I think adding the registry would be the best choice since i dont want the user to disable my application. Anyway, thanks a lot. Really appreciate it.
First i should say that i havent actually done this myself (but i have done it in regedit manually). I dont think you should add it to both of them, as then some(?) users might have two instances of the program running. Instead just add a new (i think its called)string into HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run and it will start for all users, both ones existing upon adding the string, and future accounts. Users can still (depending on rights) remove the startup via regedit or msconfig(or other programs like hijackthis). :)
//Johannes
-
First i should say that i havent actually done this myself (but i have done it in regedit manually). I dont think you should add it to both of them, as then some(?) users might have two instances of the program running. Instead just add a new (i think its called)string into HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run and it will start for all users, both ones existing upon adding the string, and future accounts. Users can still (depending on rights) remove the startup via regedit or msconfig(or other programs like hijackthis). :)
//Johannes
ok. i think i already got it by googling some issues that needs to be concerned also following your guide through your comment. I also need to find a way to write the registry by going through a service which could write the registry during my application is installed to the computer. My application is coded using VC++. Anyway, thanks a lot for ure help. Appreciated a lot.
-
So u mean that just add a new string value initiating the path of my application in the regedit to both HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run and the program will run automatically after startup? I think adding the registry would be the best choice since i dont want the user to disable my application. Anyway, thanks a lot. Really appreciate it.
If you put under the CURRENT USER key, then it will only run when the currently loggged in user logs in again. If it's put under the LOCAL MACHINE key, then it'll run whenever ANY user logs in.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007