How to run programs on Windows startup

Dec 9, 2012 at 3:20pm
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 ?
Dec 9, 2012 at 5:46pm
Dec 10, 2012 at 11:35pm
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 Dec 10, 2012 at 11:36pm
Dec 11, 2012 at 6:29pm
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++)
Dec 11, 2012 at 8:34pm
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
Dec 11, 2012 at 9:41pm
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 Dec 11, 2012 at 9:42pm
Dec 12, 2012 at 12:42am
int main(int argc, char* argv[]) {

argv[0] is a string that contains the current directory and file name.
Dec 12, 2012 at 1:34am
Also GetModuleFileName does the job of getting your exes name.
Last edited on Dec 12, 2012 at 1:35am
Dec 12, 2012 at 10:51pm
Thanks a lot for answers now all work perfect again thanks :-)
Last edited on Dec 12, 2012 at 11:04pm
Dec 13, 2012 at 5:29am
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.