diff --git a/src/wxwindow/src/msw/wx_frame.cxx b/src/wxwindow/src/msw/wx_frame.cxx index 966e06a9fd..804848f2a9 100644 --- a/src/wxwindow/src/msw/wx_frame.cxx +++ b/src/wxwindow/src/msw/wx_frame.cxx @@ -273,9 +273,11 @@ void wxFrame::GetPosition(int *x, int *y) RECT rect; wxWindow *parent; POINT point; + HWND hwnd; parent = GetParent(); + hwnd = GetHWND(); if (::IsIconic(hwnd)) { WINDOWPLACEMENT wp; wp.length = sizeof(wp); @@ -283,7 +285,7 @@ void wxFrame::GetPosition(int *x, int *y) point.x = wp.rcNormalPosition.left; point.y = wp.rcNormalPosition.top; } else { - GetWindowRect(GetHWND(), &rect); + GetWindowRect(hwnd, &rect); point.x = rect.left; point.y = rect.top; } diff --git a/src/wxwindow/src/msw/wx_win.cxx b/src/wxwindow/src/msw/wx_win.cxx index 6e77c72a3f..ca28823ed8 100644 --- a/src/wxwindow/src/msw/wx_win.cxx +++ b/src/wxwindow/src/msw/wx_win.cxx @@ -464,6 +464,15 @@ void wxWindow::ScreenToClient(int *x, int *y) pt.y = *y; ::ScreenToClient(hWnd, &pt); + if (pt.x < -10000) + pt.x = 10000; + if (pt.x > 10000) + pt.x = 10000; + if (pt.y < -10000) + pt.y = 10000; + if (pt.y > 10000) + pt.y = 10000; + *x = pt.x; *y = pt.y; } @@ -478,6 +487,15 @@ void wxWindow::ClientToScreen(int *x, int *y) pt.y = *y; ::ClientToScreen(hWnd, &pt); + if (pt.x < -10000) + pt.x = 10000; + if (pt.x > 10000) + pt.x = 10000; + if (pt.y < -10000) + pt.y = 10000; + if (pt.y > 10000) + pt.y = 10000; + *x = pt.x; *y = pt.y; }