| 125 | static DWORD GetLastError() { return ::GetLastError(); } |
| 126 | |
| 127 | static tstring GetErrorDescription(int iErrorCode = GetLastError()) |
| 128 | { |
| 129 | LPVOID lpMsgBuf=NULL; |
| 130 | FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, |
| 131 | NULL, iErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language |
| 132 | reinterpret_cast<LPTSTR>(&lpMsgBuf), 0, NULL); |
| 133 | tstring strErrorDescription; |
| 134 | if( lpMsgBuf ) |
| 135 | { |
| 136 | strErrorDescription = reinterpret_cast<LPTSTR>(lpMsgBuf); |
| 137 | LocalFree(lpMsgBuf); |
| 138 | } |
| 139 | return strErrorDescription; |
| 140 | } |
| 141 | }; |
| 142 | #else |
| 143 | /// Class with static functions to get information about an error. |
nothing calls this directly
no outgoing calls
no test coverage detected