找回密码
 加入
搜索
查看: 2926|回复: 2

[AU3基础] [已解决]wmi转au3的问题,请问\root\default:StdRegProv这个转法?

[复制链接]
发表于 2011-3-15 16:49:55 | 显示全部楼层 |阅读模式
本帖最后由 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


谢谢楼下的...
发表于 2011-3-15 22:09:09 | 显示全部楼层
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!
 楼主| 发表于 2011-3-16 07:47:35 | 显示全部楼层
本帖最后由 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
呃,我开始是这样的.怎么我的弹不出来的,,,,,,,,
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 12:19 , Processed in 0.076839 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表