CWinApp::WriteProfileInt
Visual Studio 2012
Call this member function to write the specified value into the specified section of the application's registry or .INI file.
BOOL WriteProfileInt( LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue );
This example uses CWinApp* pApp = AfxGetApp(); to get at the CWinApp class illustrating a way that WriteProfileString, WriteProfileInt, GetProfileString, and GetProfileInt can be used from any function in an MFC application.
CWinApp* pApp = AfxGetApp(); CString strSection = _T("My Section"); CString strStringItem = _T("My String Item"); CString strIntItem = _T("My Int Item"); pApp->WriteProfileString(strSection, strStringItem, _T("test")); CString strValue; strValue = pApp->GetProfileString(strSection, strStringItem); ASSERT(strValue == _T("test")); pApp->WriteProfileInt(strSection, strIntItem, 1234); int nValue; nValue = pApp->GetProfileInt(strSection, strIntItem, 0); ASSERT(nValue == 1234);
For another example, see the example for CWinApp::GetProfileInt.