首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

windows上设置开机自启动代码(c语言)

2012-08-25 
windows下设置开机自启动代码(c语言)windows下设置开机自启动(c语言)#include windows.h#include stdio

windows下设置开机自启动代码(c语言)
windows下设置开机自启动(c语言)

#include <windows.h>#include <stdio.h>int main(){HKEY hRoot = HKEY_LOCAL_MACHINE;char *szSubKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";char *szModule = "D:\\software\\eclipse\\eclipse.exe";HKEY hKey;DWORD dwDisposition = REG_OPENED_EXISTING_KEY;LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);if(lRet != ERROR_SUCCESS){printf("failed to find !\n");return -1;}lRet = RegSetValueEx(hKey, "eclipse", 0, REG_SZ, (BYTE *)szModule, strlen(szModule));RegCloseKey(hKey);if(lRet != ERROR_SUCCESS){printf("failed to reg !\n");return -1;}return 0;}

热点排行