I have a program in C++ which I want to run on Windows startup. I want to create a new string value on Windows registry at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run**
How can I do that using code?
This can be done using WinApi functions to manipulate registry keys, see here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724875%28v=vs.85%29.aspx
In particular RegOpenKey, RegSetKeyValue, RegCloseKey.
Note that to do that under HKEY_LOCAL_MACHINE the app needs to be run with elevated permissions. For HKEY_CURRENT_USER the app can do that with the regular user permissions.