首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

用vbscript写的代码如何才能在vb里使用?(关于WMI)

2012-03-08 
用vbscript写的代码怎么才能在vb里使用?(关于WMI)constHKEY_LOCAL_MACHINE&H80000001strComputer. Set

用vbscript写的代码怎么才能在vb里使用?(关于WMI)
const   HKEY_LOCAL_MACHINE   =   &H80000001
strComputer   =   ". "
Set   StdOut   =   WScript.StdOut
Set   oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\ "   &_  
strComputer   &   "\root\default:StdRegProv ")

        strKeyPath   =   "SOFTWARE\Husen2K\config "
        strValueName   =   "text "
        strValue   =   "text1 "
        oReg.SetStringValue   HKEY_LOCAL_MACHINE,   strKeyPath,   strValueName,   strValue
这是代码,怎么才能在vb里用呢

[解决办法]
Dim oReg As SWbemObject
Dim strKeyPath As String, strValueName As String, strValue As String

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = ". "
'Set StdOut = WScript.StdOut
Set oReg = GetObject( "winmgmts:{impersonationLevel=impersonate}!\\ " & strComputer & "\root\default:StdRegProv ")
strKeyPath = "SOFTWARE\ "
strValueName = "123456 "
strValue = "123456 "
oReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue

热点排行