How can I make my program run on startup by adding it to the registry?
<p>I have a VC++ console application that I want to make run on startup. I want to do this by adding it to the registry I have already tried what I found on another post about this but it didnt work, I logged out and then signed back in but the program didnt start. Here is the code I used</p>

<pre><code>string progPath = "C:/Users/user/AppData/Roaming/Microsoft/Windows/MyApp.exe";
HKEY hkey = NULL;
long createStatus = RegCreateKey(HKEY_CURRENT_USER, L"/SOFTWARE/Microsoft/Windows/CurrentVersion/Run", &amp;hkey);//Creates a key


long status = RegSetValueEx(hkey, L"MyApp", 0, REG_SZ, (BYTE *)progPath.c_str(), sizeof(progPath.c_str()));
</code></pre>

<p>Any help is appreciated</p>