VB如何修改注册表

来源:百度知道 编辑:UC知道 时间:2024/09/28 13:29:38
哪些声明代码添加在哪里,是标准模块,还是窗体模块的函数外。

请详细些

dim WshShell as object
set WshShell=createobject("wscript.shell")

WshShell.RegDelete
RegDelete 从注册表中删除名为 strName 的键或值。

语法
WshShell.RegDelete strName

参数
strName
如果 strName 以反斜杠 (\) 结束,则该方法删除键而不是值。
strName 参数必须以下列之一的根键名开始:

短根键名 长根键名
HKCU HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
HKCR HKEY_CLASSES_ROOT
HKEY_USERS
HKEY_CURRENT_CONFIG

示例
Set WshShell = Wscript.CreateObject("Wscript.Shell")

WshShell.RegDelete "HKCU\ScriptEngine\Value" '' Delete value "Value"
WshShell.RegDelete "HKCU\ScriptEngine\Key\" '' Delete key "Key"

请参阅
WshShell.RegRead 方法、WshShell.RegWrite 方法

WshShell.RegRead
RegRead 方法返回名为 strName 的注册表键或值。

语法
WshShell.RegRead(strName) = strValue

参数
strName
如果 strName 以反