REG_CREATE_KEY, DISPLAY_REG_CREATE_KEY

Creates a specified registry key by providing access to the Windows registry routine RegCreateKey. If the key already exists, this function opens it (same functionality as REG_OPEN_KEY). If the key does not exist, it is created and then opened.
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_CREATE_KEY when you want the action to be performed 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_CREATE_KEY when you want the action to be performed 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_CREATE_KEY" 
    USING OPEN-KEY-HANDLE, SUBKEY-TO-BE-CREATED, 
        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

The key created or opened by REG_CREATE_KEY is a subkey of the key identified by OPEN-KEY-HANDLE.

SUBKEY-TO-BE-CREATED PIC X(n) Name of the subkey to create or open.
SUBKEY-HANDLE Usage unsigned-long Data item to receive the handle of the newly created or opened key.
STATUS-CODE Numeric data item. Receives the return status of the call to Microsoft's RegCreateKey function. A return status of zero indicates success; non-zero indicates that an error occurred.

Comments

REG_CREATE_KEY may be used to create several keys at once.

For example, by setting SUBKEY-TO-BE-CREATED to

     "key1\key2\key3"

you could create three keys, where key3 is a subkey of key2, key2 is a subkey of key1, and key1 is a subkey of the key specified by OPEN-KEY-HANDLE. The lowest-level key (key3 in this example) is the one that is opened and has its handle returned in SUBKEY-HANDLE.

Compatibility Issues

  • REG_CREATE_KEY is a Windows-only routine.
  • DISPLAY_REG_CREATE_KEY is not supported.
  • acugui.def is not supplied in this COBOL system.
  • Thin client technology is not supported in this COBOL system.