#pragma warning(disable:4786) #define STRICT 1 #define WIN32_LEAN_AND_MEAN #include #include using namespace std; #pragma hdrstop // * * * * * * * * * * LONG lErrorCodeCount=0; bool DisplayError(LONG lErrorCode) { LPTSTR lpMsgBuf=NULL; int ReturnSize; ReturnSize = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR)&lpMsgBuf, 0, NULL); if (!lpMsgBuf || !ReturnSize) return false; ++lErrorCodeCount; cout << lErrorCode << ' ' << lpMsgBuf; LocalFree(lpMsgBuf); return true; } // * * * * * * * * * * int main(int argc, char *argv[], char *envp[]) { LONG lLastErrorCode, lErrorCode; // First find the last error code for (lLastErrorCode=0x4FFF; !DisplayError(lLastErrorCode); --lLastErrorCode); cout << lLastErrorCode << " last error code\n"; for (lErrorCode=0; lErrorCode