Originally Posted by
guitarist809
I'd do that, it's just that people becides me are probably going to use this program and I would like it to be automatic...
I used to have a code example of this (with functions like OpenRegEx() or something and you could set a value...)
Code:
// Assuming that c:\program files\Myapp folder exists and the MyApp.exe is in this folder
#pragma comment(lib, "advapi32.lib")
#include <windows.h>
#include <stdio.h>
char szRunKey[] = {"Software\\Microsoft\\Windows\\CurrentVersion\\Run"};
char szMyAppPath[] = {"C:\\Program Files\\MyApp\\MyApp.exe"};
char szMyappSubKey[] = {"MyApp"};
int main(void)
{
HKEY hKey;
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, szRunKey, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
if(RegSetValueEx(hKey, szMyappSubKey, 0, REG_SZ, (const unsigned char*)szMyAppPath, sizeof(szMyAppPath)) == ERROR_SUCCESS)
printf("Create Run key successful\n");
else printf("RegSetValueEx failed\n");
RegCloseKey(hKey);
}
else printf("RegOpenKeyEx key failed\n");
return 0;
}