判断注册表项下是否存在指定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:

 

评分:0

我来说两句

日历

« 2024-05-15  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 2245
  • 日志数: 13
  • 建立时间: 2010-04-20
  • 更新时间: 2011-03-28

RSS订阅

Open Toolbar