Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

CRegKey Class

This class provides methods for manipulating entries in the system registry.

class CRegKey

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 noteSecurity 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.

Header: atlbase.h

Community Additions

ADD
Show:
© 2015 Microsoft