Writing Registry Keys using a C++ Program

HI,

I want to autostart a C++ program Ive created when Windows starts.

To do that I want to write a value to the autostart part of the registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\

Ive googled before posting but I havent found anything good about writing those string values used in this section of the registry.

In short: How do I create a c++ program that writes and edits keys in the registry?

Thanks in advance!

Note: I dont want to create a huge program, just a few lines of code that can create a REG_SZ key, and then read and modify its values.
Last edited on
any reason why you dont want to just put a shortcut to your exe in the run folder under the start menu. it should do the same thing but be less dangerous then writing to the registry. its a little more user friendly too so the general user can take it out if they want
With the program I was planning to make the user could also remove it, via a config part which would change the keys value form 1 = autostart to 0 = don't autostart or vice versa.
Last edited on
That would correspond to creating and deleting the link in the autostart folder.
For registry editing, see "msdn registry" on Google, first hit.
if you use VC++ and MFC, you can use CRegKey class to do this
Topic archived. No new replies allowed.