Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A Registry Class

0.00/5 (No votes)
27 Mar 2001 1  
This represents a handy set of classes I built to ease the pain of dealing with the Registry.

Introduction

This represents a handy set of classes I built to ease the pain of dealing with the Registry. In addition to a set of high-level classes, defined in RegVars.h, there is a separate library, used by the RegVars module, Registry.h. This includes the download link for the complete source for all four files. The rest of this document describes the interface.

Overview

Using the Registry can be inconvenient. You have to learn all the Registry APIs, learn how to create keys, and then discover that you have to create the keys recursively. A real pain.

I created these classes and library to make it easy to do simple tasks with the Registry. It requires that you defined several strings in the String Table of the module that contains it, the most important one being

IDS_ROOT_PATH  "Software\\YourCompanyName\\YourProductName"

All accesses to the Registry via this library will be relative to this key.

The Registry Classes           

For most simple cases, such as integers or strings, you can use the Registry classes RegistryInt and RegistryString.

To use these, you simply declare a String Table entry with the desired access key, which itself may contain \ characters for sub-paths, for example

IDS_MY_COUNTER  "Count"

and then declare a variable of the form

RegistryInt count(IDS_MY_COUNTER);

and to load it you write

count.load(defaultvalue); // argument optional, 0 assumed

You can then access the value, which is of type int, by using

count.value

If you want to store the value in the Registry, set count.value to the value you want to store, and do

count.store();

and the value is stored in the Registry. If the steps of the path do not exist, they will be created.

The corresponding string type is RegistryString and the .value member is a CString.

RegistryString s(IDS_MY_STRING);
s.load();; // defaults to ""

will load a string value from the Registry.

The Registry Library          

The Registry Library underlies the Registry classes, and provides more detailed control. I did not provide classes for some of the interfaces because they are used infrequently enough that I didn't bother creating classes for them.

The Registry Library allows for the setting and retrieving of string values, integer values, 64-bit integer values, GUIDs, font descriptions, window placement descriptions, and arrays of DWORD values, as well as the ability to delete keys and values, enumerating keys and values, and simply getting a handle to a key for more detailed Registry API operations. 

Like the Registry classes, these always work relative to IDS_PROGRAM_ROOT and automatically create steps of the path on setting operations.

RegVars.h

Although to use this you only need to include this header file, you must link with the Registry library, which the methods used by these classes call to perform the actual Registry operations. If you include this file in any of your project files, you must include RegVars.cpp in your project or link with the compiled version RegVars.obj.

RegistryInt          

RegistryInt::RegistryInt(UINT id, HKEY r = HKEY_CURRENT_USER)

Constructs a variable of type RegistryInt

Parmeters:

UINT id

The String Table ID of the Registry key under which the value will be stored or from which the value will be retrieved.

HKEY r

The root key under which the key is specified. It will be found under the key

r\%IDS_PROGRAM_ROOT%\%id%

RegistryInt::load(int def = 0);

Loads a value from the Registry. Provides for a default value. The .value member of the variable will have either the value from the Registry or the default value when this method returns.

int def

The value to be used if the key is not found in the Registry.
RegistryInt::store();

Stores the value to the Registry under the key specified for the variable. The current contents of the .value member is what will be stored.

int value;

This is the .value member of the class.

RegistryString          

RegistryString::RegistryString(UINT id, HKEY r = HKEY_CURRENT_USER)

Constructs a variable of type RegistryString

Parmeters:

UINT id

The String Table ID of the Registry key under which the value will be stored or from which the value will be retrieved.

HKEY r

The root key under which the key is specified. It will be found under the key

r\%IDS_PROGRAM_ROOT%\%id%

RegistryString::load(LPCTSTR def = NULL);

Loads a value from the Registry. Provides for a default value. The .value member of the variable, a CString, will have either the value from the Registry or the default value when this method returns. If the string parameter value is NULL, the .value member is set to the empty string.

int def

The value to be used if the key is not found in the Registry.
RegistryString::store();

Stores the value to the Registry under the key specified for the variable. The current contents of the .value member is what will be stored.

CString value;

This is the .value member of the class.

Registry.h          

The Registry.cpp module provides for more direct access to the Registry. All operations are performed relative to the string specified by the String Table entry IDS_PROGRAM_ROOT.

These functions are used when you need closer control, for example, in creating non-constant Registry keys that are computed on the fly.

To simplify the notation, I've adapted the notation for expansion of environment strings. In this case, I use %name% to indicate the expansion of the string identified in the String Table by the value name. Thus %IDS_PROGRAM_ROOT% should be replaced, in the descriptions that follow, by the string that IDS_PROGRAM_ROOT represents, and if the name defines a variable or parameter in the program, by the string which is retrieved by the integer represented by that variable or parameter.

In all cases, if the function returns FALSE, the error can found by calling ::GetLastError(). In addition to the standard errors that can be returned from the Registry API calls, if the value is the wrong type for the operation, or of the wrong length, ::GetLastErro() will return ERROR_INVALID_DATA.

If you use this header file, or if you use the RegVars.cpp module, you must either include this in your compilation or link with the compiled RegVars.obj file. 

[Get/Set]RegistryString          

BOOL GetRegistryString(HKEY root, const CString & var, 
                       CString & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

CString & val

If the result of the call is TRUE, the contents of the Registry, which must be of type REG_SZ, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryString(HKEY root, const CString & var, 
                       const CString & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

const CString & val

If the result of the call is TRUE, the contents of this parameter will be stored as a value of  type REG_SZ.
BOOL GetRegistryString(HKEY root, const CString & path, 
                       UINT var, CString & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\%var%

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

UINT var

The variable path that defines the variable, represented by a String Table entry. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

CString & val

If the result of the call is TRUE, the contents of the Registry, which must be of type REG_SZ, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryString(HKEY root, const CString & path, 
                       UINT var, const CString & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\%var%

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

UINT var

The variable path that defines the variable, contained in the String Table entry designated by the integer var. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

const CString & val

If the result of the call is TRUE, the contents of this parameter will be stored as a value of  type REG_SZ.
BOOL GetRegistryString(HKEY root, const CString & path, 
     const CString & var, CString & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\var

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

CString & val

If the result of the call is TRUE, the contents of the Registry, which must be of type REG_SZ, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryString(HKEY root, const CString & path, 
     const CString & var, const CString & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\var

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

const CString & val

If the result of the call is TRUE, the contents of this parameter will be stored as a value of  type REG_SZ.

[Get/Set]RegistryInt          

BOOL GetRegistryInt(HKEY root, const CString & var, DWORD & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

DWORD & val

If the result of the call is TRUE, the contents of the Registry, which must be of type REG_DWORD, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryInt(HKEY root, const CString & var, DWORD val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

DWORD val

If the result of the call is TRUE, the contents of this parameter will be stored as a value of  type REG_DWORD.
BOOL GetRegistryInt(HKEY root, const CString & path, 
                    UINT var, DWORD & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\%var%

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

UINT var

The variable path that defines the variable, represented by a String Table entry. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

DWORD & val

If the result of the call is TRUE, the contents of the Registry, which must be of type REG_DWORD, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryInt(HKEY root, const CString & path, 
                    UINT var, DWORD val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\%var%

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

UINT var

The variable path that defines the variable, contained in the String Table entry designated by the integer var. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

DWORD val

If the result of the call is TRUE, the contents of this parameter will be stored as a value of  type REG_DWORD.
BOOL GetRegistryInt(HKEY root, const CString & path, 
                    const CString & var, DWORD & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\var

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

DWORD & val

If the result of the call is TRUE, the contents of the Registry, which must be of type REG_DWORD, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryInt(HKEY root, const CString & path, const CString & var, DWORD val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\path\var

const CString & path

The path from the root and program root to the value, where the var parameter specifies the remainder of the path.

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

DWORD val

If the result of the call is TRUE, the contents of this parameter will be stored as a value of  type REG_DWORD.

[Get/Set]RegistryInt64          

BOOL GetRegistryInt64(HKEY root, const CString & var, ULONGLONG & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

ULONGLONG & val

If the result of the call is TRUE, the contents of the Registry, which must be an 8-byte value of type REG_BINARY, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryInt64(HKEY root, const CString & var, ULONGLONG val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

ULONGLONG val

If the result of the call is TRUE, the contents of this parameter will be stored as an 8-byte value of  type REG_BINARY.

[Get/Set]RegistryGUID          

BOOL GetRegistryGUID(HKEY root, const CString & var, GUID & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

ULONGLONG & val

If the result of the call is TRUE, the contents of the Registry, which must be a 16-byte value of type REG_BINARY, will be found in this variable. If the result is FALSE it remains unchanged.
BOOL SetRegistryGUID(HKEY root, const CString & var, const GUID & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

ULONGLONG val

If the result of the call is TRUE, the contents of this parameter will be stored as an 8-byte value of  type REG_BINARY.

[Get/Set]RegistryFont          

BOOL GetRegistryFont(HKEY root, const CString & var, LPLOGFONT val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

LPLOGFONT val

This structure will first be completely zeroed out. If the result of the call is TRUE, the complete contents of the Registry information for the font, as represented by the values under the subkey var, will be found in this structure. If the result is FALSE the fields will be partially filled in.
BOOL SetRegistryFont(HKEY root, const CString & var, const LOGFONT * val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

const LOGFONT * val

If the result of the call is TRUE, the contents of this parameter will be stored as a set of values under the subkey var.

For a font, the var represents not a value, but a key under which the values are stored. The following components of the LOGFONT structure are stored. Note that this is not the complete set of possible values. For example, I had no need to store font rotation information.

key type meaning

<code>lfHeight

REG_DWORD

Font height

<code>lfWeight

REG_DWORD

Font weight, FW_ symbols

<code>lfItalic

REG_WORD

TRUE for italic font

<code>lfUnderline

REG_DWORD

TRUE for underlined font

<code>lfStrikeout

REG_DWORD

TRUE for strikeout font

<code>lfFaceName

REG_SZ

Name of font

[Get/Set]RegistryWindowPlacement          

BOOL GetRegistryWindowPlacement(HKEY root, 
     const CString & var, WINDOWPLACEMENT * val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.

WINDOWPLACEMENT * val

This structure will first be completely zeroed out. If the result of the call is TRUE, the complete contents of the Registry information for the WINDOWPLACEMENT, as represented by the values under the subkey var, will be found in this structure. If the result is FALSE the fields will be partially filled in.
BOOL SetRegistryWindowPlacement(HKEY root, const CString & var, 
                                const WINDOWPLACEMENT * val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

const WINDOWPLACEMENT * val

If the result of the call is TRUE, the contents of this parameter will be stored as a set of values under the subkey var.

For a font, the var represents not a value, but a key under which the values are stored. The following components of the LOGFONT structure are stored. Note that this is not the complete set of possible values. For example, I had no need to store font rotation information. This information requires you to define the String Table keys in the table shown below. If you do not define the key IDS_KEY_PLACEMENT_FLAGS, the WINDOWPLACEMENT functions will not be available.

In the sample download, there is a file resource.h that contains these symbols, and a file test.rc that contains the String Table entries.

key Typical name type meaning

IDS_KEY_PLACEMENT_ FLAGS

"WindowPlacement\\ Flags"

REG_DWORD

The flags value of the structure

IDS_KEY_PLACEMENT_ SHOWCMD

"WindowPlacement\\ ShowCmd"

REG_DWORD

The restoration value, for example, SW_MINIMIZE, SW_MAXIMIZE, or SW_RESTORE

IDS_KEY_PLACEMENT_ MINPOSITION_X

"WindowPlacement\\ MinPosition\\x"

REG_WORD

Location of icon, left edge.

IDS_KEY_PLACEMENT_ MINPOSITION_Y

"WindowPlacement\\ MinPosition\\y"

REG_DWORD

Location of icon, top edge

IDS_KEY_PLACEMENT_ MAXPOSITION_X

"WindowPlacement\\ MaxPosition\\x"

REG_DWORD

Location of maximized window, left edge

IDS_KEY_PLACEMENT_ MAXPOSITION_Y

"WindowPlacement\\ MaxPosition\\y"

REG_DWORD

Location of maximized window, top edge

IDS_KEY_PLACEMENT_ NORMAL_LEFT

"WindowPlacement\\ NormalPosition\\left"

REG_DWORD

Location of normalized window, left edge

KEY_PLACEMENT_ NORMAL_TOP

"WindowPlacement\\ NormalPosition\\top"

REG_DWORD

Location of normalized window, top edge

KEY_PLACEMENT_ NORMAL_RIGHT

"WindowPlacement\\ NormalPosition\\right"

REG_DWORD

Location of normalized window, right edge

KEY_PLACEMENT_ NORMAL_BOTTOM

"WindowPlacement\\ NormalPosition\\bottom"

REG_DWORD

Location of normalized window, bottom edge

[Get/Set]RegistryDWordArray          

CDWordArray * GetRegistryDWordArray(HKEY root, const CString & var);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the call returns FALSE. Note that this string can include \ characters describing more complex paths.
<code>return value If successful, a newly-created CDWordArray object. It is the responsibility of the caller of this function to delete this array when it is no longer required. If there is an error, the return value is NULL.
BOOL SetRegistryDWordArray(HKEY root, const CString & var, CDWordArray & val);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, it will be created. If there is any error during the creation, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

CDWordArray & val

If the result of the call is TRUE, the contents of this parameter will be stored as a REG_BINARY value..

DeleteRegistry[Key/Value]          

BOOL DeleteRegistryKey(HKEY root, const CString & keyname);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & keyname

The variable path that defines the key. If the path does not exist, the call returns TRUE. If the path exists, an attempt is made to delete it; if it is successfully deleted, the return value is TRUE. If there is a deletion failure, it returns FALSE.
BOOL DeleteRegistryValue(HKEY root, const CString & var);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\var

const CString & var

The variable path that defines the variable. If the path does not exist, the return value is TRUE. If the path exists, the variable will be deleted. If there is any error during the deletion, this call returns FALSE. Note that this string can include \ characters describing more complex paths.

[Get/Find]RegistryKey          

BOOL GetRegistryKey(HKEY root, const CString & keyname, HKEY & key);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\keyname

const CString & keyname

The variable path that defines the parent key. If the path does not exist, an attempt is made to create it. If the creation succeeds, or the path already exists, the key value is set, and the call returns TRUE. If the path does not exist, and cannot be created, the call returns FALSE

HKEY & key

The Registry key handle which represents the key defined by the keyname path for the current program root. This value is valid only if the function returns TRUE.
BOOL FindRegistryKey(HKEY root, const CString & keyname, HKEY & key);

HKEY root

The root relative to which the key is found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\keyname

const CString & keyname

The variable path that defines the key. If the path does not exist, the return value is FALSE and no attempt is made to create it. If the path exists, a key handle is opened and returned in the key provided. Note that this string can include \ characters describing more complex paths.

HKEY & key

The Registry key handle which represents the key defined by the keyname path for the current program root. This value is valid only if the function returns TRUE.

EnumRegistry[Keys/Values]          

CStringArray * EnumRegistryKeys(HKEY root, const CString & keyname);

HKEY root

The root relative to which the keys are found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\keyname

const CString & keyname

The variable path that defines the parent key. If the path does not exist, the call returns NULL. If the path exists, the subkeys are enumerated and returned in the resulting CStringArray. It is the responsibility of the caller to delete the CStringArray which is returned.
CStringArray * EnumRegistryValues(HKEY root, const CString & keyname);

HKEY root

The root relative to which the keys are found, typically HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE. The key will be evaluated as

root\%IDS_PROGRAM_ROOT%\keyname

const CString & keyname

The variable path that defines the parent key. If the path does not exist, the return value is NULL. If the path exists, the names of all the values under the key are returned in the resulting CStringArray. It is the responsibility of the calller to delete the CStringArray that is returned. Note that this string can include \ characters describing more complex paths.

The views expressed in these essays are those of the author, and in no way represent, nor are they endorsed by, Microsoft.

Send mail to newcomer@flounder.com with questions or comments about this web site.
Copyright � 1999 CompanyLongName All Rights Reserved.
www.flounder.com/mvp_tips.htm

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here