common project localization: move out all updating strings

- finish localizing boostrapper/runner/action_runner
This commit is contained in:
yuyoyuppe
2020-10-22 19:02:59 +03:00
committed by Andrey Nekrasov
parent 5629e8068b
commit f33b3c771a
18 changed files with 427 additions and 181 deletions

View File

@@ -85,22 +85,22 @@ std::optional<std::wstring> get_last_error_message(const DWORD dw)
return message;
}
void show_last_error_message(LPCWSTR lpszFunction, DWORD dw, LPCWSTR errorTitle)
void show_last_error_message(LPCWSTR functionName, DWORD dw, LPCWSTR errorTitle)
{
const auto system_message = get_last_error_message(dw);
if (!system_message.has_value())
{
return;
}
LPWSTR lpDisplayBuf = (LPWSTR)LocalAlloc(LMEM_ZEROINIT, (system_message->size() + lstrlenW(lpszFunction) + 40) * sizeof(WCHAR));
LPWSTR lpDisplayBuf = (LPWSTR)LocalAlloc(LMEM_ZEROINIT, (system_message->size() + lstrlenW(functionName) + 40) * sizeof(WCHAR));
if (lpDisplayBuf != NULL)
{
StringCchPrintfW(lpDisplayBuf,
LocalSize(lpDisplayBuf) / sizeof(WCHAR),
localized_strings::LAST_ERROR_FORMAT_STRING,
lpszFunction,
dw,
system_message->c_str());
L"%s: %s (%d)",
functionName,
system_message->c_str(),
dw);
MessageBoxW(NULL, (LPCTSTR)lpDisplayBuf, errorTitle, MB_OK | MB_ICONERROR);
LocalFree(lpDisplayBuf);
}