im having a little problem that i cant figure out, this piece of code
add's the exe (that is being executed) to bootup (dont know how
to call it in english) could somebody please show me how i can set a path to the exe that should be added to bootup instead of
the curent exe that is being executed (since my "instaler" puts
the files in another directory).
help very apreciated !
HKEY hkey;
char *szBuf;
TCHAR buff[255];
DWORD bufflLen = 255;
LPTSTR dirBuff = buff;
GetCurrentDirectory(buffLen, dirBuff);
buffLen = strlen(dirBuff);
if(buffLen > 3)
szBuf = strcat(dirBuff, "\\myprogram.exe");
else
szBuf = strcat(dirBuff, "myprogram.exe");
RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\Currentversion\\Run ", 0, KEY_SET_VALUE, &hkey);
RegSetValueEx (hkey, "myprogram", 0, REG_SZ (LPBYTE) szBuf, strlen(szBuf) + 1);
RegCloseKey(hkey);