Do not know about the global configuration of how others are handled, the most recent things are used in the global configuration, and to save the software settings, the next time you start to use the last shutdown configuration.
My approach is to build a class to hold and read the configuration, and to create variables in this class that are used by all interface classes and processing classes.
For example, the name of this class
Cgloableconfig
For example, I use a variable in a lot of dialog boxes or processing classes.
CString Strllow;
This variable is required to be read from the configuration file when the software is started, and when the software is closed, the size of this value in a dialog box needs to be known in a processing class.
A globally configured class that defines an object in CMainFrame, which is, of course, defined in the main view for a single document or dialog box for a multi-document program.
Cgloableconfig gloablecfg;
In this cgloableconfig, there is an initialization function, a save function at exit.
void Cgloableconfig::init (CString strfile)
void Cgloableconfig::saveconfig (CString strfile)
The INI file is used as the configuration file, and the Init function is called to read the value when the software is started.
GetPrivateProfileString ("panding", "Llow", "Odd", chartemp,20,strfile);
Strllow.format ("%s", chartemp);
Call Saveconfig to save the value at exit
WritePrivateProfileString ("panding", "Llow", strllow,strfile);
In the dialog box that sets this value, you can modify this value to first get a pointer to the main window
cmainframe* pMainFrame = (cmainframe*) AfxGetMainWnd ();
Pmainframe->gloablecfg.strllow = "12345";
If it's a single document, get a pointer to the main view
Cbrightnessmeasureview * Pmainview = (cbrightnessmeasureview*) ((cframewnd*) AfxGetApp ()->m_pmainwnd) GetActiveView ();
Pmainview->gloablecfg.strllow = "12345";
When using this value, the same as to get the main window or the main view of the pointer, and then get gloablecfg, in order to normal use.
MFC Global Configuration Read Save configuration