TA的每日心情 | 奋斗 2014-12-18 10:31 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
判断注册表项下是否存在指定KEY,代码如下
HKEY_LOCAL_MACHINE=&H80000002
HKEY_CURRENT_USER=&H80000001
'判断HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer下是否存在Build这个键
Allkey HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Internet Explorer","Build"
Function Allkey(intRoot,strKeyPath,checkkey)
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
oReg.EnumValues intRoot,strKeyPath,arrValueNames
For i=0 To UBound(arrValueNames)
oReg.GetStringValue intRoot, strKeyPath,arrValueNames(i),strvalue
If arrValueNames(i)=checkkey Then
Msgbox checkkey&"存在"
Exit for
End If
If i=UBound(arrValueNames) and arrValueNames(i)<>checkkey Then
Msgbox checkkey&"不存在"
End If
Next
End Function
[ 本帖最后由 feiyunkai 于 2010-5-13 18:15 编辑 ] |
|