wxCheckWindowWndProc() now checks for the original window proc in the window class and not for the current (possibly subclasses) window proc

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-08-16 00:53:45 +00:00
parent df7145da50
commit 42cfcc58ee

View File

@ -430,10 +430,7 @@ bool wxWindowMSW::Create(wxWindow *parent,
msflags |= WS_VISIBLE; msflags |= WS_VISIBLE;
} }
bool retVal = MSWCreate(wxCanvasClassName, NULL, pos, size, msflags, exstyle); return MSWCreate(wxCanvasClassName, NULL, pos, size, msflags, exstyle);
if (retVal)
SetWindowLong( (HWND)m_hWnd, GWL_WNDPROC, (LONG)wxWndProc);
return retVal;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -1028,35 +1025,21 @@ void wxWindowMSW::UnsubclassWin()
bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc) bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc)
{ {
#if wxUSE_UNICODE_MSLU // Unicows note: the code below works, but only because WNDCLASS contains
// VS: We can't use GetWindowLong(hwnd, GWL_WNDPROC) together with unicows.dll // original window handler rather that the unicows fake one. This may not
// because it doesn't return pointer to the real wnd proc but rather a handle // be on purpose, though; if it stops working with future versions of
// of a fake proc that does Unicode<->ANSI translation. // unicows.dll, we can override unicows hooks by setting
// // Unicows_{Set,Get}WindowLong and Unicows_RegisterClass to our own
// The hack bellow works, because WNDCLASS contains original window handler // versions that keep track of fake<->real wnd proc mapping.
// rather that the unicows fake one. This may not be on purpose, though; if WNDCLASS cls;
// it stops working with future versions of unicows.dll, we can override if ( !::GetClassInfo(wxGetInstance(), wxGetWindowClass(hWnd), &cls) )
// unicows hooks by setting Unicows_{Set,Get}WindowLong and
// Unicows_RegisterClass to our own versions that keep track of
// fake<->real wnd proc mapping.
//
// FIXME: Doesn't handle wnd procs set by SetWindowLong, only these set
// with RegisterClass!!
if ( wxUsingUnicowsDll() )
{ {
static wxChar buffer[512]; wxLogLastError(_T("GetClassInfo"));
WNDCLASS cls;
::GetClassName((HWND)hWnd, buffer, 512); return FALSE;
::GetClassInfo(wxGetInstance(), buffer, &cls);
return wndProc == (WXFARPROC)cls.lpfnWndProc;
}
else
#endif
{
return wndProc == (WXFARPROC)::GetWindowLong((HWND)hWnd, GWL_WNDPROC);
} }
return wndProc == (WXFARPROC)cls.lpfnWndProc;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------