如何VB添加注册表的子项啊?

来源:百度知道 编辑:UC知道 时间:2024/06/24 13:43:03
Set Reg = CreateObject("Wscript.Shell")
Reg.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\DelegateFolders\{59031a47-3f72-44a7-89c5-5595fe6b30ee}\"

上面是删除{59031a47-3f72-44a7-89c5-5595fe6b30ee}

我现在要把{59031a47-3f72-44a7-89c5-5595fe6b30ee}添加回去Reg.什么方法
是子项,不是类

请仔细看看:
反斜杠 (\) 结束表示添加键(子键)
非反斜杠结束表示添加值
-----------------------------------

WshShell.RegWrite
RegWrite 方法设置名为 strName 的注册表键或值。

语法
WshShell.RegWrite strName, anyValue, [strType]

参数
strName
若 strName 以一个反斜杠 (\) 结束,则该方法设置键,而不是值。
strName 参数必须以下列根键名开头。

Short Long
HKCU HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
HKCR HKEY_CLASSES_ROOT
HKEY_USERS
HKEY_CURRENT_CONFIG

anyValue
当 strType 为 REG_SZ 或 REG_EXPAND_SZ 时,RegWrite 方法自动将 anyValue 转换为字符串。若 strType 为 REG_DWORD,则 anyValue 被转换为整数。若 strType 为 REG_BINARY,则 anyValue 必须是一个整数。

strType
RegWrite 方法支持 strType 为 REG_SZ、REG_EXPAND_SZ、REG_DWORD 和 REG_BINARY。若其他的数据类型被作为 strType 传递,RegWrite 返回 E_INVALIDARG。
示例
Set WshShell = Wscript.CreateObject("Wscript.Shell")

WshShell.RegWrite "HKCU\ScriptEngine\Value", "Some string value"
WshShell.RegWrite &