About Me

Gaurav Seth is a a Senior Automation Test Analyst with experience in QTP, Selenium and Ranorex tools and currently working on Automating in C# for a FX trading Client

Windows Registry with QTP

The following snippet of code will create an entry in the Registry and give the Value to it.

Sub SetRegistryValue(strRegPath, strRegValue)
Set shObj = CreateObject("WScript.Shell")
shObj.RegWrite strRegPath, strRegValue
End Sub

Function GetRegistryValue(strRegPath)
Set shObj = CreateObject("WScript.Shell")
GetRegistryValue = shObj.RegRead(strRegPath)
End Function


SetRegistryValue "HKEY_CLASSES_ROOT\.ANUNAY\KEY2", "http://hpqtpautomation.blogspot.com/"
Msgbox GetRegistryValue("HKEY_CLASSES_ROOT\.ANUNAY\KEY2")






'You can use the Following Code to delete the Registry Entry
Set shObj = CreateObject("WScript.Shell")
shObj.RegDelete "HKEY_CLASSES_ROOT\.ANUNAY\KEY"


No comments:

Post a Comment