How to run programs on Windows startup

Hi, guys.
I am looking for something to run programs on Windows startup. I know a manually way, but I am looking for some simple function in windows.h, because not all users have OS in C: drive.

Can someone help me ?
Also see:

INFO: Run, RunOnce, RunServices, RunServicesOnce and Startup
http://support.microsoft.com/kb/179365

Run and RunOnce Registry Keys
http://msdn.microsoft.com/en-us/library/aa376977%28v=vs.85%29.aspx
Last edited on
Thanks it was usefull, but only way i find to write to registers is:
 
using namespace Microsoft::Win32;


But I never find in which header file can be.

Is there some other option to write to registers ?(c++)
For registry functions you only need to include windows.h and link against advapi32 library.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724875(v=vs.85).aspx
Thanks, Last thing.
when i put value(REG_ZS) to registry:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

I must set current location of the .exe, this brings me to the question:
How to determine location of currently running program (.exe) ?
Last edited on
int main(int argc, char* argv[]) {

argv[0] is a string that contains the current directory and file name.
Also GetModuleFileName does the job of getting your exes name.
Last edited on
Thanks a lot for answers now all work perfect again thanks :-)
Last edited on
argv[0] is a string that contains the current directory and file name.


Do not assume this, is not always correct.
Topic archived. No new replies allowed.