Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CRegKey::Open

 

Call this method to open the specified key and set m_hKey to the handle of this key.


      LONG Open(
   HKEY hKeyParent,
   LPCTSTR lpszKeyName,
   REGSAM samDesired = KEY_READ | KEY_WRITE
) throw( );

hKeyParent

The handle of an open key.

lpszKeyName

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

samDesired

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 Windows SDK.

If successful, returns ERROR_SUCCESS; otherwise, a non-zero error value defined in WINERROR.H.

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.

Requirements

Header: atlbase.h

Show: