fix a problem with Unicows (patch 720542)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-05-01 16:46:28 +00:00
parent 2015f2b308
commit ea39221211

View File

@@ -230,9 +230,33 @@ wxFindReplaceDialogImpl::~wxFindReplaceDialogImpl()
LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
WPARAM wParam, LPARAM lParam)
{
#if wxUSE_UNICODE_MSLU
static unsigned long s_lastMsgFlags = 0;
// This flag helps us to identify the bogus ANSI message
// sent by UNICOWS.DLL (see below)
// while we're sending our message to the dialog
// we ignore possible messages sent in between
static bool s_blockMsg = false;
#endif // wxUSE_UNICODE_MSLU
if ( nMsg == wxFindReplaceDialogImpl::GetFindDialogMessage() )
{
FINDREPLACE *pFR = (FINDREPLACE *)lParam;
#if wxUSE_UNICODE_MSLU
// This is a hack for a MSLU problem: Versions up to 1.0.4011
// of UNICOWS.DLL send the correct UNICODE item after button press
// and a bogus ANSI mode item right after this, so lets ignore
// the second bogus message
if ( s_lastMsgFlags == pFR->Flags )
{
s_lastMsgFlags = 0;
return 0;
}
s_lastMsgFlags = pFR->Flags;
#endif // wxUSE_UNICODE_MSLU
wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData;
// map flags from Windows
@@ -288,8 +312,20 @@ LRESULT APIENTRY wxFindReplaceWindowProc(HWND hwnd, WXUINT nMsg,
event.SetReplaceString(pFR->lpstrReplaceWith);
}
#if wxUSE_UNICODE_MSLU
s_blockMsg = true;
#endif // wxUSE_UNICODE_MSLU
dialog->Send(event);
#if wxUSE_UNICODE_MSLU
s_blockMsg = false;
#endif // wxUSE_UNICODE_MSLU
}
#if wxUSE_UNICODE_MSLU
else if ( !s_blockMsg )
s_lastMsgFlags = 0;
#endif // wxUSE_UNICODE_MSLU
WNDPROC wndProc = (WNDPROC)::GetWindowLong(hwnd, GWL_USERDATA);