CWinApp::WriteProfileBinary
Visual Studio 2012
Call this member function to write binary data into the specified section of the application's registry or .INI file.
BOOL WriteProfileBinary( LPCTSTR lpszSection, LPCTSTR lpszEntry, LPBYTE pData, UINT nBytes );
This example uses CWinApp* pApp = AfxGetApp(); to get at the CWinApp class illustrating a way that WriteProfileBinary and GetProfileBinary can be used from any function in an MFC application.
CWinApp* pApp = AfxGetApp(); CString strSection = _T("My Section"); CString strItem = _T("My Binary Item"); double myData = 123.456e12; pApp->WriteProfileBinary(strSection, strItem, (LPBYTE)&myData, sizeof(myData)); double *pData; UINT n; pApp->GetProfileBinary(strSection, strItem, (LPBYTE*)&pData, &n); ASSERT(n == sizeof(myData)); ASSERT(myData = *pData); delete [] pData; // free the buffer
For another example, see the example for CWinApp::GetProfileBinary.