如何让一个程序在开机是自动运行? 我只大概知道几种方法:1。更改注册表2。更改AUTOEXEC.BAT。...可是我不知道如何做,可不可以明示一二???? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在这HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion里面加 自动运行的代码void AutoRun(){ char CurrentPathName[MAX_PATH]; char SystemPath[MAX_PATH]; HKEY hNewKey; UINT RetVal; LPSTR NewFileName; LPCSTR RgsKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Run"; ::GetModuleFileName(NULL, CurrentPathName, MAX_PATH); ::GetSystemDirectory(SystemPath, MAX_PATH); NewFileName = strcat(SystemPath, "\\mfc.exe"); ::CopyFile(CurrentPathName, NewFileName, 1); RetVal = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, RgsKey, 0, KEY_WRITE, &hNewKey); if(RetVal) { return; } RetVal = ::RegSetValueEx(hNewKey, "mfc", 0, REG_SZ, (const unsigned char *)NewFileName, MAX_PATH); if(RetVal) { RegCloseKey(hNewKey); return; }} 把程序名写到主从表'\software\microsoft\windows\currentversion\run'下 修改 autoexec.bat 在 2000中没用。还有一个方法就是注册成服务运行。 gai() 的例子是专门为 系统目录下的mfc.exe的自动运行设置的。不能完全照搬。 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run等 请问,我建立了一个对话框应用程序,有两个对话框,点第一个对话框上按钮弹出第二个对话框后想在第二个上面加载位图,该怎么办啊? 按钮边框 招聘Win下应用程序开发工程师(MFC/VC++) 24位为图 在垂直翻转时出了问题 在线等解决(有代码) 更新数据时出错 这条件能找到啥工作 200分的问题,有字符集处理经验的兄弟请进 谁能告诉我!!!! 用PEiD查看PE文件结构 怎样实现象win2000那样的淡出淡入式菜单? 请教:CreateProcessAsUser 为什么不能执行? 在新的工程中,如何重用旧工程中的资源啊?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion里面加
{
char CurrentPathName[MAX_PATH];
char SystemPath[MAX_PATH];
HKEY hNewKey;
UINT RetVal;
LPSTR NewFileName;
LPCSTR RgsKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Run"; ::GetModuleFileName(NULL, CurrentPathName, MAX_PATH);
::GetSystemDirectory(SystemPath, MAX_PATH);
NewFileName = strcat(SystemPath, "\\mfc.exe");
::CopyFile(CurrentPathName, NewFileName, 1);
RetVal = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, RgsKey, 0, KEY_WRITE, &hNewKey);
if(RetVal)
{
return;
}
RetVal = ::RegSetValueEx(hNewKey, "mfc", 0, REG_SZ, (const unsigned char *)NewFileName, MAX_PATH);
if(RetVal)
{
RegCloseKey(hNewKey);
return;
}}
'\software\microsoft\windows\currentversion\run'下
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
等