您的位置:首页 > 其它

mfc设置程序开机自启动

2014-12-04 09:17 253 查看
程序初始化中加:

char system[MAX_PATH];

char pathtofile[MAX_PATH];

HMODULE GetModH = GetModuleHandle(NULL);

GetModuleFileName(GetModH,pathtofile,sizeof(pathtofile));

HKEY hKey;

RegOpenKeyEx(HKEY_LOCAL_MACHINE,

"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&hKey );

RegSetValueEx(hKey, "Writing to the Registry Example",

0,REG_SZ,(const unsigned char*)pathtofile,strlen(pathtofile));

RegCloseKey(hKey);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: