RegOpenKey

Returns a handle to an existing registration database key.

Syntax:

RegOpenKey(handle, subkey-string [,view-flag])

Parameters:

(i) handle handle to a registration database key.

(s) subkey-string a path from the key provided to the desired key.

(i) view-flag [optional] controls which registry view the function uses when accessing the Windows registry.
0 - view indicated by the last call to the RegOpenFlags.
32 - use the 32-bit registry view.
64 - use the 64-bit registry view.

Returns:

(i) key a handle to the new key.

 

The RegOpenKey function will open a desired key into the Registration Database. If the key does not exist, RegOpenKey will fail. When using RegOpenKey you must pass a pre-existing, open key to create a new key. A pre-defined key may be used.

Note: The opened key should be closed with RegCloseKey

View-flag

This optional parameter controls which registry view the function uses when accessing the Windows registry. The optional parameter's values can be 32 to use the 32-bit view, 64 to use the 64-bit view, or 0 to use the view indicated by the last call to the RegOpenFlags. The parameter value of 0 can also causes a function to use the WinBatch default 64-bit view, if no call to RegOpenFlags has been made and setting the parameter to 0 is equivalent to omitting the parameter entirely.

Notes:

Example:


; Find default text editor
key=RegOpenKey(@REGCLASSES, "txtfile")
who=RegQueryValue(key, "shell\open\command")
RegCloseKey(key)
Message("Default text file editor is", who)
;
; The preceding is actually a hard way to do ...
who=RegQueryValue(@REGCLASSES, "txtfile\shell\open\command")
Message("Default text file editor is", who)
See Also:

RegOpenFlags, RegOpenKeyEx, RegCreateKey, RegCloseKey, RegDeleteKey, RegSetValue, RegQueryValue, RegQueryKey, and the section on Registration Database Operations