Function Reference


_WinAPI_RegOpenKey

Opens the specified registry key

#include <WinAPIReg.au3>
_WinAPI_RegOpenKey ( $hKey [, $sSubKey = '' [, $iAccess = 0x000F003F]] )

Parameters

$hKey Handle to an open registry key. This handle is returned by the _WinAPI_RegCreateKey() or _WinAPI_RegOpenKey()
function, or it can be one of the following predefined keys.
$HKEY_CLASSES_ROOT
$HKEY_CURRENT_USER
$HKEY_LOCAL_MACHINE
$HKEY_USERS
$sSubKey [optional] The name of the registry subkey to be opened (see remarks).
$iAccess [optional] A mask that specifies the desired access rights to the key. The function fails if the security
descriptor of the key does not permit the requested access for the calling process. This parameter
can be one or more of the $KEY_* constants. Default is $KEY_ALL_ACCESS.

Return Value

Success: Handle to the opened key.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the system error code.

Remarks

Unlike the _WinAPI_RegCreateKey() function, the _WinAPI_RegOpenKey() function does not create the specified key
if the key does not exist in the registry.

If the key is not one of the predefined registry keys ($HKEY_*) you must call the _WinAPI_RegCloseKey()
function after finished using the handle.

Key names are not case sensitive.

The $sSubKey parameter can be an an empty string.
If $sSubKey is an empty string and $hKey is HKEY_CLASSES_ROOT, the return is the same $hKey handle passed into the function.
Otherwise, the return is a new handle to the key specified by $hKey.

The $sSubKey parameter can be NULL only if $hKey is one of the predefined keys.
If $sSubKey is NULL and $hKey is HKEY_CLASSES_ROOT, the return is a new handle to the key specified by $hKey.
Otherwise, the return is the same $hKey handle passed in to the function.

Related

_WinAPI_RegCloseKey, _WinAPI_RegCreateKey

See Also

Search RegOpenKeyEx in MSDN Library.