Add wxMSWFormatMessage() and use it from other places
Don't duplicate calls to ::FormatMessage(), which is difficult to use correctly, in wxCrashReport and wxWebRequestWinHTTP, but just reuse the same code that was already present in wxSysErrorMsgStr() after refactoring it into a reusable function allowing to specify the module name to use for the error code lookup (before falling back to interpreting it as system error code). This fixes not trimming the trailing "\r\n" from the string in the other places (wxWinHTTPErrorToString() had code to do it, but it was wrong, while wxCrashContext::GetExceptionString() didn't do it at all) and avoids duplication.
This commit is contained in:
@@ -972,6 +972,10 @@ enum wxWinVersion
|
||||
|
||||
WXDLLIMPEXP_BASE wxWinVersion wxGetWinVersion();
|
||||
|
||||
// This is similar to wxSysErrorMsgStr(), but takes an extra HMODULE parameter
|
||||
// specific to wxMSW.
|
||||
WXDLLIMPEXP_BASE wxString wxMSWFormatMessage(DWORD nErrCode, HMODULE hModule = 0);
|
||||
|
||||
#if wxUSE_GUI && defined(__WXMSW__)
|
||||
|
||||
// cursor stuff
|
||||
|
Reference in New Issue
Block a user