Try to fix #15 restore window position is incorrect

- Get monitor handle from HWND using MONITOR_DEFAULTTONEAREST param

Signed-off-by: jiajia_deng <2894220@gmail.com>
This commit is contained in:
jiajia_deng 2019-05-24 10:34:20 +08:00
parent 1b4fac0355
commit 9ee965d558

View File

@ -83,7 +83,7 @@ LRESULT WindowImplBase::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lPa
{ {
POINT pt = { 0, 0 }; POINT pt = { 0, 0 };
HMONITOR hMontorPrimary = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); HMONITOR hMontorPrimary = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
HMONITOR hMonitorTo = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTOPRIMARY); HMONITOR hMonitorTo = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
if (hMonitorTo != hMontorPrimary) if (hMonitorTo != hMontorPrimary)
{ {