contents.gifindex.gifprev1.gifnext1.gif

REG_CREATE_KEY Routine

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.

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_31 [for Windows 3.1]
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.