Edit: After further testing, the solution below does not work if your application class is derived from CWinAppEx ! It works if your application is directly obtained from CWinApp .
To save values ββin a .ini file instead of a registry:
SetRegistryKey call to SetRegistryKey .In your application class, set m_pszProfileName to the full path to your .ini file. The file name string should be allocated using malloc , because the framework will call free when your application shuts down. First, the existing value is free , then assign a new line:
free((void*)m_pszProfileName);
m_pszProfileName = ::_tcsdup(_T("C:\\somedir\\myini.ini"));
Call CWinApp::GetProfileInt , CWinApp::WriteProfileInt and similar functions as usual.
I highly recommend using the path in APPDATA to store your .ini file.
source share