ESLREG Subroutine
Open a specified Windows Registry key.
OpenReg(integer:RegID_IV,
integer:Key_IV,
string:SubKey_SV,
string:AccessMode_SV)
Parameters
RegID_IV
An integer variable that will hold the handle to the registry key, which must be used in later calls to the registry function. The handle must be zero when this routine is called. The handle will be zero, if the open fails.
Key_IV
This must be one of the following predefined keys:
REG_CLASSES_ROOT |
HKEY_CLASSES_ROOT |
REG_CURRENT_USER |
HKEY_CURRENT_USER |
REG_LOCAL_MACHINE |
HKEY_LOCAL_MACHINE |
REG_USERS |
HKEY_USERS |
REG_PERFORMANCE_DATA |
HKEY_PERFORMANCE_DATA |
REG_PERFORMANCE_TEXT |
HKEY_PERFORMANCE_TEXT |
REG_PERFORMANCE_NLSTEXT |
HKEY_PERFORMANCE_NLSTEXT |
REG_CURRENT_CONFIG |
HKEY_CURRENT_CONFIG |
REG_DYN_DATA |
HKEY_DYN_DATA |
SubKey_SV
The name of the sub-key to be opened. Typically the sub-key will be a subordinate of an existing sub-key. A full path to the required key must be specified using the backslash character (i.e. \) to separate each level of key. The key names are not case sensitive. (Note. As the backslash character is used as to indicate an escape sequence, you must use a double backslash when creating the string variable, as in the following example:)
copy "Software\\ESLSyndetic\\" Version_LSV "\\EslEdit\\" Title_SV to SubKey_LSV
AccessMode_SV
This a string starting with either, "R" for read-only access to the registry key, or "W" for update access. If the open specifies a key that does not currently exist, and the access mode is to allow updates, then the key will automatically be created. (Note. Only the first character in the string is significant and this parameter is not case sensitive.)
Returns
One of the following codes will be returned in the pseudo variable, "errorlevel":
REG_E_ERRORFREE |
Operation was successful. |
REG_E_NOTFOUND |
Registry entry not found. |
REG_E_BADMODE |
Unrecognised access mode specified. |
REG_E_BADHANDLE |
The Key Handle being passed is invalid (must be zero). |
REG_E_BADKEY |
Key does not exist. |
REG_E_BADSUBKEY |
The format of the sub-key is invalid. |
Description
This routines opens the specified Windows registry key, so that later Registry routines can access the values stored within the Registry. We recommend that the Registry open, processing and close are performed within a single response, so the key is not left open for an extended period. Typically the registry is opened in "Read-Only" mode when starting an application, or opening a region, to obtain the required settings, then immediately closed. If the registry key does not exist, then hard-coded default settings are used. The registry is then re-opened in "Update" mode and the settings saved as the region or application is closed.