CRegKey Class
This class provides methods for manipulating entries in the system registry.
Important
This class and its members cannot be used in applications that execute in the Windows Runtime.
class CRegKey
Members
Public Constructors
Name |
Description |
---|---|
The constructor. |
|
The destructor. |
Public Methods
Name |
Description |
---|---|
Call this method to attach an HKEY to the CRegKey object by setting the m_hKey member handle to hKey. |
|
Call this method to release the m_hKey member handle and set it to NULL. |
|
Call this method to create the specified key, if it does not exist as a subkey of hKeyParent. |
|
Call this method to remove the specified key from the registry. |
|
Call this method to remove a value field from m_hKey. |
|
Call this method to detach the m_hKey member handle from the CRegKey object and set m_hKey to NULL. |
|
Call this method to enumerate the subkeys of the open registry key. |
|
Call this method to write all of the attributes of the open registry key into the registry. |
|
Call this method to retrieve a copy of the security descriptor protecting the open registry key. |
|
This method notifies the caller about changes to the attributes or contents of the open registry key. |
|
Call this method to open the specified key and set m_hKey to the handle of this key. |
|
Call this method to retrieve the binary data for a specified value name. |
|
Call this method to retrieve the DWORD data for a specified value name. |
|
Call this method to retrieve the GUID data for a specified value name. |
|
Call this method to retrieve the multistring data for a specified value name. |
|
Call this method to retrieve the QWORD data for a specified value name. |
|
Call this method to retrieve the string data for a specified value name. |
|
Call this method to retrieve the data for the specified value field of m_hKey. Earlier versions of this method are no longer supported and are marked as ATL_DEPRECATED. |
|
Call this method to remove the specified key from the registry and explicitly remove any subkeys. |
|
Call this method to set the binary value of the registry key. |
|
Call this method to set the DWORD value of the registry key. |
|
Call this method to set the GUID value of the registry key. |
|
Call this method to set the security of the registry key. |
|
Call this method to store data in a specified value field of a specified key. |
|
Call this method to set the multistring value of the registry key. |
|
Call this method to set the QWORD value of the registry key. |
|
Call this method to set the string value of the registry key. |
|
Call this method to store data in the specified value field of m_hKey. Earlier versions of this method are no longer supported and are marked as ATL_DEPRECATED. |
Public Operators
Name |
Description |
---|---|
Converts a CRegKey object to an HKEY. |
|
Assignment operator. |
Public Data Members
Name |
Description |
---|---|
Contains a handle of the registry key associated with the CRegKey object. |
|
Pointer to CAtlTransactionManager object |
Remarks
CRegKey provides methods for creating and deleting keys and values in the system registry. The registry contains an installation-specific set of definitions for system components, such as software version numbers, logical-to-physical mappings of installed hardware, and COM objects.
CRegKey provides a programming interface to the system registry for a given machine. For example, to open a particular registry key, call CRegKey::Open. To retrieve or modify a data value, call CRegKey::QueryValue or CRegKey::SetValue, respectively. To close a key, call CRegKey::Close.
When you close a key, its registry data is written (flushed) to the hard disk. This process may take several seconds. If your application must explicitly write registry data to the hard disk, you can call the RegFlushKey Win32 function. However, RegFlushKey uses many system resources and should be called only when absolutely necessary.
Security Note |
---|
Any methods that allow the caller to specify a registry location have the potential to read data that cannot be trusted. Methods that make use of RegQueryValueEx should take into consideration that this function does not explicitly handle strings which are NULL terminated. Both conditions should be checked for by the calling code. |
Requirements
Header: atlbase.h