怎么改成 c++的用法
#include <Windows.h>#include <tchar.h>
int main(void)
{
HKEY hKey;
HKEY hNewKey;
DWORD dwDisposition=0;
__try
{
char binPath[MAX_PATH]="D:\\Program Files\\QQ\\Bin\\QQ.exe";//在这里设置你要启动的程序的路径
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),
0,KEY_ALL_ACCESS,&hKey)!=ERROR_SUCCESS)
__leave;
if(RegSetValueEx(hKey,
_T("AutoStart"),
0,REG_SZ,(const BYTE*)binPath,
strlen(binPath)+1)!=ERROR_SUCCESS)
__leave;
}
__finally
{
RegCloseKey(hKey);
}
system("pause");
return(0);
}