RegOpenKeyEx Subroutine

Opens an existing registry key. FactoryGlobals provides the Declare statement in GlobalSubroutines so you can use this Windows API call without declaring it in your procedures.

NOTE: For Crystal XI users, use the PrintReport subroutine instead of using the RegOpenKeyEx and RegCloseKeyEx subroutines. The PrintReport subroutine will do all of the registry entries for you.

Syntax

RegOpenKeyEx (hKey, lpSubKey, ulOptions, samDesired, phkResult)

Properties

The RegOpenKeyEx subroutine syntax has these parts:

Part

Description

hKey

Long. Handle of an open key or one of the standard key names.
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_CURRENT_CONFIG
HKEY_DYN_DATA
Use the VB5.0 API Viewer to get the correct hex number for the key.

lpSubKey

String. Name of the key to open.

ulOptions

Long. Unused. Set to zero.

samDesired

Long. One or more constants with the prefix KEY_ that describes which operation are allowed for this key.

phkResult

Long. Variable to load with a handle to the open key.

Return Value

Long. Zero on success. All other values indicate an error.

Remarks

RegOpenKeyEx is a Windows API call.

 

Example