mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 23:06:18 +00:00
Changed: Display a warning when SetWindowTextW fails
This commit is contained in:
parent
b1fb6d2ec2
commit
c0a63db70c
5 changed files with 32 additions and 7 deletions
|
@ -2267,7 +2267,10 @@ bool CDriverD3D::getCurrentScreenMode(GfxMode &gfxMode)
|
|||
// ***************************************************************************
|
||||
void CDriverD3D::setWindowTitle(const ucstring &title)
|
||||
{
|
||||
SetWindowTextW(_HWnd,(WCHAR*)title.c_str());
|
||||
if (!SetWindowTextW(_HWnd, (WCHAR*)title.c_str()))
|
||||
{
|
||||
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -2314,7 +2314,10 @@ void CDriverGL::setWindowTitle(const ucstring &title)
|
|||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
SetWindowTextW(_win, (WCHAR*)title.c_str());
|
||||
if (!SetWindowTextW(_win, (WCHAR*)title.c_str()))
|
||||
{
|
||||
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
|
||||
}
|
||||
|
||||
#elif defined(NL_OS_MAC)
|
||||
|
||||
|
|
|
@ -40,7 +40,10 @@ void CWin32Util::localizeWindow(HWND wnd)
|
|||
std::string winText = wideToUtf8(str);
|
||||
if (CI18N::hasTranslation(winText))
|
||||
{
|
||||
SetWindowTextW(wnd, (const WCHAR *) CI18N::get(winText).c_str());
|
||||
if (!SetWindowTextW(wnd, (const WCHAR *) CI18N::get(winText).c_str()))
|
||||
{
|
||||
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
HWND currSon = GetWindow(wnd, GW_CHILD);
|
||||
|
|
|
@ -217,8 +217,13 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
ucstring ucs;
|
||||
// convert the text from UTF-8 to unicode
|
||||
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
|
||||
|
||||
// set the text as unicode string
|
||||
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
|
||||
if (!SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str()))
|
||||
{
|
||||
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
|
||||
}
|
||||
|
||||
SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
|
||||
}
|
||||
}
|
||||
|
@ -234,8 +239,13 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
ucstring ucs;
|
||||
// convert the text from UTF-8 to unicode
|
||||
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
|
||||
|
||||
// set the text as unicode string
|
||||
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
|
||||
if (!SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str()))
|
||||
{
|
||||
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
|
||||
}
|
||||
|
||||
SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +362,10 @@ void CWinDisplayer::setTitleBar (const string &titleBar)
|
|||
|
||||
nldebug("SERVICE: Set title bar to '%s'", wn.c_str());
|
||||
|
||||
SetWindowTextW (_HWnd, (LPWSTR)ucstring::makeFromUtf8(wn).c_str());
|
||||
if (!SetWindowTextW(_HWnd, (LPWSTR)ucstring::makeFromUtf8(wn).c_str()))
|
||||
{
|
||||
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)
|
||||
|
|
|
@ -257,7 +257,10 @@ static INT_PTR CALLBACK ExitClientErrorDialogProc(HWND hwndDlg, UINT uMsg, WPARA
|
|||
{
|
||||
if (CI18N::hasTranslation("TheSagaOfRyzom"))
|
||||
{
|
||||
SetWindowTextW(hwndDlg, (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str ());
|
||||
if (!SetWindowTextW(hwndDlg, (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str ()))
|
||||
{
|
||||
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
|
||||
}
|
||||
}
|
||||
SetDlgItemTextW(hwndDlg, IDC_ERROR_MSG_TEXT, (WCHAR*) CurrentErrorMessage.c_str ());
|
||||
if (CI18N::hasTranslation("uiRyzomErrorMsgBoxExit"))
|
||||
|
|
Loading…
Reference in a new issue