phRootKey - cRegistry
Specifies the root branch of the Registry to use
Type: Property
Access: Read/Write
Data Type: Handle
Parameters: None
Syntax
Property Handle phRootKey
| Access Type | Syntax |
|---|---|
| Read Access: | Get phRootKey to HandleVariable |
| Write Access: | Set phRootKey to HandleVariable/Value |
Description
The phRootKey property specifies which hierarchical branch of the Registry that all future OpenKey, CreateKey and KeyExists methods should refer to.
You can set this property to any of the following constants:
HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS HKEY_PERFORMANCE_DATA HKEY_CURRENT_CONFIG HKEY_DYN_DATA
The default root Key is HKEY_CURRENT_USER, which is the branch of the Registry that is specific to the user currently logged in. When your application writes to the Registry, it typically writes to this branch.
Example
This example shows how to access the Registry to read how many subkeys the "Data Access Worldwide" key in the HKEY_LOCAL_MACHINE branch has.
Procedure DoShowCountOfSubkeys String sKey
Boolean bOpened bExists
Handle hoRegistry
Get Create (RefClass(cRegistry)) to hoRegistry
// Set the default of phRootKey...
Set phRootKey of hoRegistry to HKEY_LOCAL_MACHINE
// set access rights to read
Set pfAccessRights of hoRegistry to Key_Read
// check if this is a 64 bit machine
// if so, the Wow6432Node key will exist
Get KeyExists of hoRegistry "SOFTWARE\Wow6432Node" to bExists
If bExists Begin
Move (Append("SOFTWARE\Wow6432Node\", sKey)) to sKey
End
Else Begin
Move (Append("SOFTWARE\", sKey)) to sKey
End
Get KeyExists of hoRegistry sKey to bExists
If bExists Begin
// Open the Key...
Get OpenKey of hoRegistry sKey to bOpened
If bOpened Begin
Send Info_Box (CountOfSubkeys(hoRegistry)) 'Count='
Send CloseKey of hoRegistry
End
End
Send Destroy of hoRegistry
End_Procedure
Send DoShowIfDAWKeyExists of oRegistry