HKEY hKey;
char szFileName[256];
GetModuleFileName(NULL,szFileName,256);
RegOpenKey(HKEY_LOCAL_MACHINE,”SOFTWARE//Microsoft//windows//currentversion//run”,&hKey);
if(m_bAutoRun)
{
RegSetValueEx(hKey,”RunmeAtStartup”,0,REG_SZ,(BYTE *)szFileName,sizeof(szFileName));
}
else
{
RegDeleteValue(hKey,”RunmeAtStartup”);
}
RegCloseKey(hKey);