Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

How to add program to startup

Hey mates .
how can I add my program to START .
I need my program to start everytime when windows starts .
any API or suggestions ?
thanks.
[161 byte] By [ms_n00b] at [2007-11-11 10:08:01]
# 1 Re: How to add program to startup
If you want the app to run after a user logs in, add a shortcut to the application to the user's Startup folder, or add the application to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run. If you want it to run even no user is logged in, install it as a Windows Service: http://support.microsoft.com/kb/175948
Phil Weber at 2007-11-11 17:23:06 >
# 2 Re: How to add program to startup
Do u need to put it in "start" or only make it run at startup ?
puting it in "start" menu is very classic .. and easy too , just you need to get the start menu location , and put a shortcut of your exe file in the startup folder ..
but if you need the better method to make programme run at startup then u have to put a registry key in this location :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run //(for the whole machine)
or
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run //(for the current user only)

the key name isn't important but the value must contains the location of the exe file .
Amahdy at 2007-11-11 17:24:17 >
# 3 Re: How to add program to startup
I ment statup .
Anyway , so I have to know the location of the File (loc of my program). ?
How can I guess it?
I'm sure theres a simple way to ADD my program to STARTUP
with API or something.

maybe There is an option to use FILECOPY function ?
and then to use regedit ?
maybe someone can help me with a simple source code ?

thanks for the helpers.
ms_n00b at 2007-11-11 17:25:12 >
# 4 Re: How to add program to startup
Sure you must know the location of your programme or u need that windows guess it every time it strartup ?
the location of your application could be retrived by "app.path" an it's name by "app.exename" : you need both of them ; [ app.path & "\" & app.exename ]
this is the value of the key you will creat in the regesitry in the specified location .
Amahdy at 2007-11-11 17:26:17 >
# 5 Re: How to add program to startup
ok :
Text1.Text = App.Path & "\" & App.EXEName
Work fine
But how do I put a register key ?
it should be sample any1 can show me a code ?

Thanks again .
ms_n00b at 2007-11-11 17:27:16 >
# 6 Re: How to add program to startup
Search in freevbcode or google in how to store values in registry using vb6 .
it's a userdefined types u need and three apis doing that .
Amahdy at 2007-11-11 17:28:17 >