Det er nemmere at bruge klassen CRegKey som indkapsler API kaldene og ens handle. CRegKey kan bruges ved at inkludere filen atlbase.h.
---
CRegKey
class CRegKey
CRegKey provides methods for manipulating 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 theRegFlushKey Win32 function. However, RegFlushKey uses many system resources and should be called only when absolutely necessary.
#include <atlbase.h>
---
Hth
Indlæg senest redigeret d. 09.11.2006 21:44 af Bruger #10448