contents.gifindex.gifprev1.gifnext1.gif

REG_OPEN_KEY Routine

Opens a specified registry key by accessing the Windows registry routine RegOpenKey.

Usage

 Call "REG_OPEN_KEY" 
   USING OPEN-KEY-HANDLE, SUBKEY-TO-BE-OPENED, 
      SUBKEY-HANDLE, 
   GIVING STATUS-CODE

Parameters

OPEN-KEY-HANDLE Usage unsigned-long

Handle of a currently open key or one of the following predefined handles of keys that are always open (defined in acugui.def):

HKEY_CLASSES_ROOT_31 [for Windows 3.1]
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS

SUBKEY-TO-BE-OPENED PIC X(n)

String containing the name of the key to open. This key must be a subkey of the key identified by OPEN-KEY-HANDLE.

SUBKEY-HANDLE Usage unsigned-long

Data item to receive the handle of the opened key.

STATUS-CODE Numeric data item

Receives the return status of the call to Microsoft's "RegOpenKey" function. A return status of zero indicates success; non-zero indicates that an error occurred.

Comments

You can use REG_OPEN_KEY to open a key several layers deep in the registry tree structure. For example, if you set SUBKEY-TO-BE-OPENED to a string of the form:

"level_1\level_2\level_3"

this would open the key "level_3", where "level_3" is a subkey of "level_2", "level_2" is a subkey of "level_1", and "level_1" is a subkey of the key specified by OPEN-KEY-HANDLE.