char szValue[MAX_PATH]={0};
strcpy(szValue,"D:\\Temp\\Win32\\bin\\Debug\\Project1.exe");
HKEY hKey;
if(RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&hKey)==ERROR_SUCCESS)
{
if(!(RegSetValueEx(hKey,"Project1",NULL,REG_SZ,(const BYTE*)&szValue,strlen(szValue))==ERROR_SUCCESS))
{
RegSetValueEx(hKey,"Project1",NULL,REG_SZ,(const BYTE*)&szValue,strlen(szValue));
}
}
C++笔记(开机启动部分)
最新推荐文章于 2022-06-03 09:05:14 发布