Bagikan melalui


CSettingsStoreSP::Create

Creates a new instance of an object that is derived from the CSettingsStore Class.

CSettingsStore& CSettingsStoreSP Create(
   BOOL bAdmin,
   BOOL bReadOnly
);

Parameters

  • [in] bAdmin
    A Boolean parameter that determines whether a CSettingsStore object is created in administrator mode.

  • [in] bReadOnly
    A Boolean parameter that determines whether a CSettingsStore object is created for read-only access.

Return Value

A reference to the newly created CSettingsStore object.

Remarks

You can use the method CSettingsStoreSP::SetRuntimeClass to determine what type of object CSettingsStoreSP::Create will create. By default, this method creates a CSettingsStore object.

If you create a CSettingsStore object in administrator mode, the default location for all registry access is HKEY_LOCAL_MACHINE. Otherwise, the default location for all registry access is HKEY_CURRENT_USER.

If bAdmin is TRUE, the application must have administration rights. Otherwise, it will fail when it tries to access the registry.

Example

The following example demonstrates how to use the Create method of the CSettingsStoreSP class.

    CSettingsStoreSP regSP;
    CSettingsStore& reg = regSP.Create(FALSE, TRUE);

Requirements

Header: afxsettingsstore.h

See Also

Reference

CSettingsStoreSP Class

Hierarchy Chart

CSettingsStoreSP::SetRuntimeClass

CSettingsStore Class