[已解决]wmi转au3的问题,请问\root\default:StdRegProv这个转法?
本帖最后由 onepc 于 2011-3-16 07:50 编辑他的枚举方法式.EnumKey
如何写?
里面的不知是什么类型的
strHost = ". "
Const HKLM = &H80000002
Set objReg = GetObject( "winmgmts:// " & strHost & _
"/root/default:StdRegProv ")
Const strBaseKey = _
"Software\Microsoft\Windows\CurrentVersion\Uninstall\ "
objReg.EnumKey HKLM, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"DisplayName ", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKLM, strBaseKey & strSubKey, _
"QuietDisplayName ", strValue)
End If
If (strValue <> " ") and (intRet = 0) Then
WScript.Echo strValue
End If
Next
谢谢楼下的... dim $arrSubKeys,$strValue
$strHost='.'
$HKLM=0x80000002
$objReg=objget("winmgmts://"&$strHost&"/root/default:StdRegProv")
$strBaseKey="Software\Microsoft\Windows\CurrentVersion\Uninstall\"
$objReg.EnumKey($HKLM,$strBaseKey,$arrSubKeys)
For $strSubKey In $arrSubKeys
$intRet=$objReg.GetStringValue($HKLM,$strBaseKey&$strSubKey,"DisplayName",$strValue)
If $intRet<>0 Then
$intRet=$objReg.GetStringValue($HKLM,$strBaseKey&$strSubKey,"QuietDisplayName",$strValue)
EndIf
If ($strValue<>" ") and ($intRet=0) Then
msgbox(0,"",$strValue)
EndIf
Next原来就是枚举注册表,其实不用这样的,au3不是有现成的吗?RegEnumKey! 本帖最后由 onepc 于 2011-3-16 07:55 编辑
;远程连接计算机的WMI
;root/default:StdRegProv
Func _ConnectDefault($Comp,$User,$Pass)
If $comp==@ComputerName Then
$objServiceReg = ObjGet("winmgmts:\\.\root\default:StdRegProv")
Else
$objLocatorReg = ObjCreate("WbemScripting.SWbemLocator")
$objServiceReg = $objLocatorReg.ConnectServer($Comp, "root\default:StdRegProv",$User,$Pass)
$objServiceReg.Security_.ImpersonationLevel = 3
;$objInfos = $objService.ExecQuery("select * from Win32_Process")
EndIf
EndFunc
c
Dim $objInfos
_GUICtrlListView_DeleteAllItems($ListView5);清空方法列表
$objService.EnumKey($HKLM,$strUnKey,$objInfos)
;objReg.EnumKey HKLM, strBaseKey, arrSubKeys
;$objInfos = $objServiceReg.ExecQuery("")
For $objInfo In $objInfos
;GUICtrlCreateListViewItem($objInfo.name&"|"&$objInfo.Description,$ListView5)
MsgBox(0,"",$objInfo)
Next呃,我开始是这样的.怎么我的弹不出来的,,,,,,,,
页:
[1]