Storages.Registry Method

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Use this method to get the Section object for the system registry key. This will allow you to manage subkeys and values (we will call them sections and options) through this object.

Declaration

Storages.Registry(Key, RootKey, RegistryType, ReadOnly)

Key [in]    Required    String    
RootKey [in]    Optional    Long Default value: HKEY_CURRENT_USER   
RegistryType [in]    Optional    Integer Default value: 0   
ReadOnly [in]    Optional    Boolean Default value: False   
Result A Section object

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Key

Specifies the full path to the desired key from the root key. If the key does not exist, the method will create it.

RootKey

Specifies the root key the desired key belongs to:

Constant
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_PERFORMANCE_DATA
HKEY_CURRENT_CONFIG
HKEY_DYN_DATA

RootKey equals to the value of the HKEY_CURRENT_USER constant by default.

RegistryType

This parameter is significant if you use TestComplete on a 64-bit operating system. It specifies which registry view, 32-bit or 64-bit, the method will access. You can use one of the following constants:

Constant Value Description
AQRT_32_BIT 0 32-bit registry (default)
AQRT_64_BIT 1 64-bit registry

ReadOnly

If this parameter's value is True, the Registry key will be opened in read-only mode. Otherwise, it is opened in read-write mode.

Result Value

A Section object that provides scripting access to the specified registry key.

Remarks

The returned Section object lets you obtain and change registry values of the REG_DWORD, REG_SZ and REG_EXPAND_SZ type only. The REG_BINARY and REG_MULTI_SZ value types are not supported.

Be careful when working with the system registry using methods of the Section object. Incorrect writing in the registry may affect the functionality of your operating system and the applications installed.

Example

To view a sample script demonstrating how to use the Registry method to access the Windows system registry, see Reading Sections and Options from the System Registry. Example.

See Also

Section Object
Binary Method
INI Method
XML Method

Highlight search results