CSettingsStoreSP Class
The CSettingsStoreSP class is a helper class that you can use to create instances of the CSettingsStore Class.
class CSettingsStoreSP
Members
Public Constructors
Name |
Description |
---|---|
Constructs a CSettingsStoreSP object. |
Public Methods
Name |
Description |
---|---|
Creates an instance of a class that is derived from CSettingsStore. |
|
Sets the runtime class. The Create method uses the runtime class to determine what class of objects to create. |
Data Members
Name |
Description |
---|---|
m_dwUserData |
Custom user data that is stored in the CSettingsStoreSP object. You supply this data in the constructor of the CSettingsStoreSP object. |
m_pRegistry |
The CSettingsStore-derived object that the Create method creates. |
Remarks
You can use the CSettingsStoreSP class to redirect all MFC registry operations to other locations, such as an XML file or a database. To do this, follow these steps:
Create a class (such as CMyStore) and derive it from CSettingsStore.
Use DECLARE_DYNCREATE and IMPLEMENT_DYNCREATE macros with your custom CSettingsStore class to enable dynamic creation.
Override the virtual functions and implement the Read and Write functions in your custom class. Implement any other functionality to read and write data to your desired location.
In your application, call CSettingsStoreSP::SetRuntimeClass and pass in a pointer to the CRuntimeClass Structure obtained from your class.
Whenever the framework would typically access the registry, it will now dynamically instantiate your custom class and use it to read or write data.
CSettingsStoreSP::SetRuntimeClass uses a global static variable. Therefore, only one custom store is available at a time.
Requirements
Header: afxsettingsstore.h