判断注册表项下是否存在指定KEY
上一篇 /
下一篇 2010-08-11 14:05:39
/ 个人分类:QTP
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 Reg=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
收藏
举报
TAG: