Export (0) Print
Expand All


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( );


The handle of an open key.


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


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.

Header: atlbase.h

© 2014 Microsoft