Registry Editor in QTP

QTP/UFT

Registry Editor in QTP

registry_editorQTP allows to create and edit a key values of registry.Registry handling is possible by using a wscript. shell object.

Refer a following code to add/edit registry values

Dim wshshell,companyname,emp1name

set wshshell=Createobject(“Wscript.shell”)

wshshell.RegWrite “HKEY_CURRENT_USER\Software\Company”,”Lion”,”Reg_SZ”

/* This will create a key in registry with the name company and add Lion as key with Reg_SZ key type *\

wshshell.RegWrite “HKEY_CURRENT_USER\Software\Company\Emp1″,”JOHN”,”Reg_SZ”

companyname=wshshell.RegRead(“HKCU\software\company\”)

emp1name=wshshell.RegRead(“HKCU\software\company\emp1”)

wshshell.RegDelete “HKCU\software\company\emp1”

wshshell.RegDelete “HKCU\software\company\”

Root key names in Registry-

Hkey_current_user HKCU
HKey_LOCAL_MACHINE HKLM
HKEY_CLASSES_ROOT HKCR
HKEY_USERS HKEY_USERS
HKEY_Current_CONFIG HKEY_Current_CONFIG

 Datatypes in Registry

Name of variables Datatypes
REG_SZ String
REG_DWord Number
REG_BINARY Binary value
REG_EXPAND_SZ Dynamic string
Leave A Comment
*
*