Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

RootKey property

Project: Window State Components.

Unit: PJWdwState.

Class: TPJRegWdwState

Applies to: ~>5.0

property RootKey: HKEY;


This property allows the user to specify the registry root key under which the window size, position and state information is recorded. The information is saved in a subkey of this root key determined by the SubKey property. If RootKey is set to an invalid HKEY value an exception is raised. Valid values are:

HKEY_CLASSES_ROOT     = $80000000;
HKEY_CURRENT_USER     = $80000001;
HKEY_LOCAL_MACHINE    = $80000002;
HKEY_USERS            = $80000003;
HKEY_CURRENT_CONFIG   = $80000005;
HKEY_DYN_DATA         = $80000006;

These values are defined in the Windows unit.

The property defaults to HKEY_CURRENT_USER.

Note: The registry root key can also be specified by handling OnGetRegData or OnGetRegDataEx [~>5.6] events. If this is done then the value of RootKey is ignored.

Alternative Property

The RootKeyEx [~>5.6] property provides an alternative way of setting the registry root key. Instead of taking an HKEY value it takes a value from the TPJRegRootKey [~>5.6] enumeration, making it impossible to specify an invalid value.

RootKeyEx [~>5.6] also makes it easier and safer to set values in Delphi’s Object Inspector since the required value is selected from a list.

Setting RootKey changes the value of RootKeyEx [~>5.6] and vice versa.