CSettingsStore Class

 

Wraps Windows API functions, providing an object-oriented interface that you use to access the registry.

class CSettingsStore : public CObject

Name

Description

CSettingsStore::CSettingsStore

Constructs a CSettingsStore object.

Name

Description

CSettingsStore::Close

Closes the open registry key.

CSettingsStore::CreateKey

Opens the specified key or creates it if it does not exist.

CSettingsStore::DeleteKey

Deletes the specified key and all its children.

CSettingsStore::DeleteValue

Deletes the specified value of the open key.

CSettingsStore::Open

Opens the specified key.

CSettingsStore::Read

Retrieves the data for a specified key value.

CSettingsStore::Write

Writes a value to the registry under the open key.

The member functions CreateKey and Open are very similar. If the registry key already exists, CreateKey and Open function in the same way. However, if the registry key does not exist, CreateKey will create it whereas Open will return an error value.

Example

The following example demonstrates how to use the Open and Read methods of the CSettingsStore class. This code snippet is part of the Tool Tip Demo sample.

CSettingsStore reg (FALSE, TRUE);
DWORD dwEnableBalloonTips = 1;

if (reg.Open (_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced")) &&
	reg.Read (_T("EnableBalloonTips"), dwEnableBalloonTips))
{
	return dwEnableBalloonTips == 1;
}

Requirements

Header: afxsettingsstore.h

Show: