CRegKey::Open

LONG Open( HKEY hKeyParent, LPCTSTR lpszKeyName, REGSAM samDesired = KEY_ALL_ACCESS );

Return Value

If successful, returns ERROR_SUCCESS; otherwise, an error value.

Parameters

hKeyParent

[in] The handle of an open key.

lpszKeyName

[in] Specifies the name of a key to be created or opened. This name must be a subkey of hKeyParent.

samDesired

[in] The security access for the key. The default value is KEY_ALL_ACCESS. For a list of possible values and descriptions, see RegCreateKeyEx in the Win32 SDK.

Remarks

Opens the specified key and sets m_hKey to the handle of this key. If the lpszKeyName parameter is NULL or points to an empty string, Open opens a new handle of the key identified by hKeyParent, but does not close any previously opened handle.

Unlike CRegKey::Create, Open will not create the specified key if it does not exist.

CRegKey OverviewClass Members

See Also   CRegKey::Close