setRootKey

setRootKey

Changes the root key being accessed.

Method of

WinReg object

Syntax

void setRootKey ( int key );

Parameters

The method has the following parameter:

key
An integer representing a root key in the registry.

Returns

Nothing.

Description

The setRootKey changes the root key.

When you create a WinReg object, it is set to access keys under the HKEY_CLASSES_ROOT portion of the registry. If you want to access keys in another portion, you must use this method to change the root key.

On 16-bit Windows platforms, HKEY_CLASSES_ROOT is the only valid value and this method does nothing.

These root keys are represented as fields of the WinReg object. The values you can use are:

HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS

Example

To use the HKEY_USERS section, use these statements:

winreg = getWinRegistry();
winreg.setRootKey(winreg.HKEY_USERS);

Document Tags and Contributors

 Last updated by: Sheppy,