Get user language description of error, if available
| 7 | |
| 8 | // Get user language description of error, if available |
| 9 | String GetSysError(int nerr /* =-1 */) |
| 10 | { |
| 11 | if (nerr == -1) |
| 12 | nerr = GetLastError(); |
| 13 | LPVOID lpMsgBuf; |
| 14 | String str = _T("?"); |
| 15 | if (FormatMessage( |
| 16 | FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 17 | FORMAT_MESSAGE_FROM_SYSTEM | |
| 18 | FORMAT_MESSAGE_IGNORE_INSERTS, |
| 19 | nullptr, |
| 20 | nerr, |
| 21 | 0, // Default language |
| 22 | (tchar_t*) &lpMsgBuf, |
| 23 | 0, |
| 24 | nullptr |
| 25 | )) |
| 26 | { |
| 27 | str = (const tchar_t*)lpMsgBuf; |
| 28 | // Free the buffer. |
| 29 | LocalFree( lpMsgBuf ); |
| 30 | } |
| 31 | return str; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @brief Get Options Manager. |
no outgoing calls
no test coverage detected