REG_OPEN_KEY, DISPLAY_REG_OPEN_KEY

Opens a specified registry key by accessing the Windows registry routine RegOpenKey.
Note: This ACUCOBOL-GT library routine is available in this COBOL version. Any compatibility issues in this COBOL system are in the Compatibility Issues section at the end of the topic.

Use DISPLAY_REG_OPEN_KEY to perform the action on the display host's registry (the local host when the application is run with a standard runtime; the thin client when the application is run with the thin client). Use REG_OPEN_KEY to perform the action on the server host's registry (the local host when the application is run with a standard runtime, and the application host when the application is run with the thin client).

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
  • 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 subkey.

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.

Compatibility Issues

  • REG_OPEN_KEY is a Windows-only routine.
  • DISPLAY_REG_OPEN_KEY is not supported.
  • Thin client technology is not supported in this COBOL system.