LPVOID lpMsgBuf;if (!FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL )){ MessageBox( NULL, _T("In FormatMessage"), _T("Error"), MB_OK | MB_ICONINFORMATION ); return 0 ;}// Display the string.MessageBox( NULL, (LPCSTR)lpMsgBuf, _T("LastError"), MB_OK | MB_ICONINFORMATION );CharToOem((LPCSTR)lpMsgBuf,(LPSTR)lpMsgBuf);cout << (LPCSTR)lpMsgBuf << endl;// Free the buffer.LocalFree( lpMsgBuf );