Compartilhar via


CSettingsStore Class

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

class CSettingsStore : public CObject

Members

Public Constructors

Name

Description

CSettingsStore::CSettingsStore

Constructs a CSettingsStore object.

Public Methods

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.

Remarks

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;
    }

Inheritance Hierarchy

CObject

   CSettingsStore

Requirements

Header: afxsettingsstore.h

See Also

Reference

Hierarchy Chart

CWinAppEx Class

Other Resources

MFC Classes