天天看點

修改系統資料庫開機自動啟動程式

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);