让程序开机自动启动
来源:互联网 发布:简单的数据分析小工具 编辑:程序博客网 时间:2024/06/10 09:07
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
HKEY RegKey;
char sPath[MAX_PATH];
//GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
strcpy(sPath , "C:\\Program Files\\NVSCenter\\NVSCenterV6.3.1.12\\Center.exe");
if(1)
{
char fullName[MAX_PATH];
RegKey=NULL;
LONG error;
strcpy(fullName , "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");//Software
error = RegOpenKey(HKEY_LOCAL_MACHINE,(LPCWSTR)fullName,&RegKey); //( LPCTSTR)
if(error != ERROR_SUCCESS)
{
/// AfxMessageBox("error");
}
error = RegSetValueEx(RegKey,(LPCWSTR)"Nvs Center",0,REG_SZ,(const unsigned char*)(LPCTSTR)sPath,57);//这里加上你需要在注册表中注册的内容
if(error != ERROR_SUCCESS)
{
// AfxMessageBox("error");
}
RegCloseKey(RegKey);
// AfxMessageBox("ok!");
}
else
{
//AfxMessageBox("Error!");
exit(0);
}
}
- 让程序开机自动启动
- 如何让程序随开机自动启动
- 如何让程序开机自动启动
- 程序开机自动启动
- 开机自动启动程序
- 开机自动启动程序
- 开机自动启动程序
- 开机自动启动程序
- 开机自动启动程序
- 开机自动启动程序
- 怎么让程序在开机时自动启动
- 在Linux系统如何让程序开机时自动启动
- 如何让A20,android开机自动启动C程序
- 在Linux系统如何让程序开机时自动启动
- (转)如何让A20,android开机自动启动C程序
- 如何让自己的程序在开机时自动启动
- 让程序开机自动运行
- 让你写的c#程序一开机就自动运行 Windows服务实现开机启动
- Windows基础设置收藏:(二)通过修改注册表来设置一些软件中隐藏起来的路径设置
- SQL 之索引
- ACE和TAO 我的理解与感悟
- sprintf
- Ubuntu 13使用Qt 5
- 让程序开机自动启动
- mybatis的应用
- 编程语言十万个为什么之java web的基础概念
- 使用Event的体会
- Android --- Gallery 循环
- The problematic NULLs
- win7可关闭服务
- 世界500强高频逻辑推理智力面试题 (三)
- 外链建设与查询方法