Making a program run on startup

This is a discussion on Making a program run on startup within the C Programming forums, part of the General Programming Boards category; I have a program that I wish to make windows run it as soon as windows starts up. How would ...

"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens

Well, since that's more of a Windows issue, you'd be better searching a Windows specific forum. Or, you know, just throwing a collection of seemingly random words at a search engine. Might I suggest the following, completely unrelated words:

"windows programming C run at startup"

I wrote a very complex random word generator, and that was the first thing that it gave me. I can run it again and give you more completely unrelated words if you need them. Honestly though, I'd just as soon not.

See, I want I my program to do this automatically, without the user having to do anything. I'm sure you can do this because I've seen loads of programs that run once windows starts.

You've been given the EXACT answer here:

Copy it (a shortcut) to the startup folder. Or... add it as a scheduled task to be run on startup.

Do you need to get it tattooed to your forehead or what?

Right click on the program executable, and select "create a shortcut". Then drag that shortcut to the user's startup menu that you want:
Documents and Settings\all users\Applications Data (AppData for Vista and Win7)\Start Up, iirc.

And quit acting like you haven't been given the correct answer already.

Right click on the program executable, and select "create a shortcut". Then drag that shortcut to the user's startup menu that you want:
Documents and Settings\all users\Applications Data (AppData for Vista and Win7)\Start Up, iirc.

And quit acting like you haven't been given the correct answer already.

I believe he means he wants his program to add something to be started automatically, not doing it by hand.
Having your program copy it to the startup folder would probably be the easiest way, but the location of the Startup folder changes with almost every version of Windows, so you'd need to find out which version of Windows you're on before you can know where to copy it...

Using the registry might be better, but you'll have to read about the Registry API functions. Here's the location to add the program to:

Adding it to HKEY_LOCAL_MACHINE makes it start up for every user on the machine (and requires admin privileges).
You can also add it to:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Curre ntVersion\Run
Which makes it start for the current user, only. This does not require admin privileges.