如何用C++将自身文件写入注册表run项?请高手们告诉一下代码。

来源:百度知道 编辑:UC知道 时间:2024/05/25 11:14:24
就是运行某个程序后,这个程序就能把自己加入到注册表的RUN中。

C++,不知道怎么写,
以下是reg和 VBS和BAT版本
reg:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"要添加的名字"="C:\\WINDOWS\\某个程序.exe"
VBS:
Dim WShShell
Set WShShell = WScript.CreateObject("WScript.Shell")
WSHShell.Popup "创建项HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run数值为

name"

WShShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","name"
WSHShell.Popup "将数值项 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\name设

为 REG_SZ C:\WINDOWS\application.exe"

WShShell.RegWrite

"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\name","C:\\WINDOWS\\application.e

xe"