In the Windows Scripting Shell (which QTP can use with VBScript), you have a few methods for reading and writing to the Windows Registry. You need to be very careful with these (especially the writing) as you could mess your test machine up if you don't know what you are doing!
First, understand that there are restrictions on the syntax of the registry root key names. They must be the following:
HKEY_CURRENT_USER or HKCU
HKEY_LOCAL_MACHINE or HKLM
HKEY_CLASSES_ROOT or HKCR
HKEY_USERS (same)
HKEY_CURRENT_CONFIG (same)
The following VBScript example writes a key and value pair into the registry, reads and displays key content, and then removes them from the registry.
'Instantiate the Wscript Shell object
Set WshShell = WScript.CreateObject(''WScript.Shell'')
'How to write to the registry
WshShell.RegWrite ''HKCUDemoQTPKey'', 1 ,''REG_DWORD''
WshShell.RegWrite ''HKCUDemoQTPKeyMyValue'', ''This Is QTP Doing This!''
'Read a registry key and print the value to the QTP Print Dialog
Print WshShell.RegRead(''HKCUDemoQTPKeyMyValue'')
Print WshShell.RegRead(''HKCUDemoQTPKey'')
'Delete the registry key/value
WshShell.RegDelete ''HKCUDemoQTPKeyMyValue''
WshShell.RegDelete ''HKCUDemoQTPKey''
'Cleanup
Set WshShell = Nothing