From ef7e065cc84dab0b8f811bae73c0a1ba10360e86 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Sat, 2 Aug 2025 14:35:53 +0800 Subject: [PATCH] fix: #176 #177 Desktop control does not work properly --- server/2015Remote/HideScreenSpyDlg.cpp | 8 ++++---- server/2015Remote/ScreenSpyDlg.cpp | 21 +++++++++------------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/server/2015Remote/HideScreenSpyDlg.cpp b/server/2015Remote/HideScreenSpyDlg.cpp index fa2cda4..5e24e23 100644 --- a/server/2015Remote/HideScreenSpyDlg.cpp +++ b/server/2015Remote/HideScreenSpyDlg.cpp @@ -773,11 +773,11 @@ void CHideScreenSpyDlg::SendScaledMouseMessage(MSG* pMsg, bool makeLP) { } MYMSG msg(*pMsg); - auto low = ((LONG)LOWORD(pMsg->lParam)) * m_wZoom; - auto high = ((LONG)HIWORD(pMsg->lParam)) * m_hZoom; + LONG low = ((LONG)LOWORD(pMsg->lParam)) * m_wZoom; + LONG high = ((LONG)HIWORD(pMsg->lParam)) * m_hZoom; if(makeLP) msg.lParam = MAKELPARAM(low, high); - msg.pt.x = (int)(low + m_rect.left); - msg.pt.y = (int)(high + m_rect.top); + msg.pt.x = low + m_rect.left; + msg.pt.y = high + m_rect.top; SendCommand(msg); } diff --git a/server/2015Remote/ScreenSpyDlg.cpp b/server/2015Remote/ScreenSpyDlg.cpp index 534679e..49d6a24 100644 --- a/server/2015Remote/ScreenSpyDlg.cpp +++ b/server/2015Remote/ScreenSpyDlg.cpp @@ -182,9 +182,8 @@ BOOL CScreenSpyDlg::OnInitDialog() SetClassLongPtr(m_hWnd, GCLP_HCURSOR, m_bIsCtrl ? (LONG_PTR)m_hRemoteCursor : (LONG_PTR)LoadCursor(NULL, IDC_NO)); GetClientRect(&m_CRect); - ScreenToClient(m_CRect); - m_wZoom = ((double)m_BitmapInfor_Full->bmiHeader.biWidth) / ((double)(m_CRect.right - m_CRect.left)); - m_hZoom = ((double)m_BitmapInfor_Full->bmiHeader.biHeight) / ((double)(m_CRect.bottom - m_CRect.top)); + m_wZoom = ((double)m_BitmapInfor_Full->bmiHeader.biWidth) / ((double)(m_CRect.Width())); + m_hZoom = ((double)m_BitmapInfor_Full->bmiHeader.biHeight) / ((double)(m_CRect.Height())); ShowScrollBar(SB_BOTH, !m_bAdaptiveSize); SendNext(); @@ -560,11 +559,12 @@ void CScreenSpyDlg::SendScaledMouseMessage(MSG* pMsg, bool makeLP) { return; MYMSG msg(*pMsg); - auto low = m_bAdaptiveSize ? ((LONG)LOWORD(pMsg->lParam)) * m_wZoom : LOWORD(pMsg->lParam) + m_ulHScrollPos; - auto high = m_bAdaptiveSize ? ((LONG)HIWORD(pMsg->lParam)) * m_hZoom : HIWORD(pMsg->lParam) + m_ulVScrollPos; + LONG x = LOWORD(pMsg->lParam), y = HIWORD(pMsg->lParam); + LONG low = m_bAdaptiveSize ? x * m_wZoom : x + m_ulHScrollPos; + LONG high = m_bAdaptiveSize ? y * m_hZoom : y + m_ulVScrollPos; if (makeLP) msg.lParam = MAKELPARAM(low, high); - msg.pt.x = (int)low; - msg.pt.y = (int)high; + msg.pt.x = low; + msg.pt.y = high; SendCommand(&msg); } @@ -836,9 +836,6 @@ void CScreenSpyDlg::OnSize(UINT nType, int cx, int cy) return; GetClientRect(&m_CRect); - ScreenToClient(m_CRect); - if (!m_bIsFirst) { - m_wZoom = ((double)m_BitmapInfor_Full->bmiHeader.biWidth) / ((double)(m_CRect.right - m_CRect.left)); - m_hZoom = ((double)m_BitmapInfor_Full->bmiHeader.biHeight) / ((double)(m_CRect.bottom - m_CRect.top)); - } + m_wZoom = ((double)m_BitmapInfor_Full->bmiHeader.biWidth) / ((double)(m_CRect.Width())); + m_hZoom = ((double)m_BitmapInfor_Full->bmiHeader.biHeight) / ((double)(m_CRect.Height())); }