Enable cwinapp :: getprofilestring to read your own INI file

zhaozj2021-02-11  165

When writing the MFC programming, the wizard will automatically create the key of this program in the registry to save some of the settings information of the program. But sometimes we don't want to save these configuration information to the registry, and there is an INI file (or other file) in the specified directory, we don't have to rewrite a Cinifile class, just need to cwinapp :: InitInstance () Several member variables for modifying CWINAPP can be, as follows:

// The following code is placed in InitInstance // First clears the memory space allocated by the registry key value variable. FREE ((void *) m_pszregistryKey); // Remove the INI variable Free ((void *) m_pszprofilename); // change INI file name. M_pszprofilename = _tcsdup ("d: //myprj/ininame.ini");

After completing the above settings, I can use the GetProfileString WriteProfileString functions.

转载请注明原文地址:https://www.9cbs.com/read-5378.html

New Post(0)