Fix/Improve: fix #267 and scale 4K desktop screen to 1080P

This commit is contained in:
yuanyuanxiang
2025-12-24 09:24:15 +01:00
parent 47ac8fb0d2
commit 2ee61a760f
20 changed files with 109 additions and 51 deletions

View File

@@ -2079,7 +2079,9 @@ void CMy2015RemoteDlg::OnMainSet()
m_frpStatus = STATUS_RUN;
}
if (use && use_new && m_hFRPThread == NULL) {
#ifdef _WIN64
MessageBoxA("FRP代理服务异常需要重启当前应用程序进行重试。", "提示", MB_ICONINFORMATION);
#endif
}
int m = atoi(THIS_CFG.GetStr("settings", "ReportInterval", "5").c_str());
int n = THIS_CFG.GetInt("settings", "SoftwareDetect");
@@ -2679,6 +2681,7 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
}
DialogBase* p = (DialogBase*)wParam;
if (p && ::IsWindow(p->GetSafeHwnd()) && p->ShouldReconnect()) {
::PostMessageA(p->GetSafeHwnd(), WM_DISCONNECT, 0, 0);
return S_OK;
}

View File

@@ -120,18 +120,20 @@ public:
bool m_bIsClosed;
bool m_bIsProcessing;
HICON m_hIcon;
BOOL m_bConnected;
CDialogBase(UINT nIDTemplate, CWnd* pParent, Server* pIOCPServer, CONTEXT_OBJECT* pContext, int nIcon) :
m_bIsClosed(false), m_bIsProcessing(false),
m_ContextObject(pContext),
m_iocpServer(pIOCPServer),
CDialog(nIDTemplate, pParent)
{
m_bConnected = TRUE;
m_IPAddress = pContext->GetPeerName().c_str();
m_hIcon = nIcon > 0 ? LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(nIcon)) : NULL;
}
int UpdateContext(CONTEXT_OBJECT* pContext)
{
m_bConnected = TRUE;
m_ContextObject = pContext;
m_iocpServer = pContext->GetServer();
m_ContextObject->hDlg = this;
@@ -163,6 +165,7 @@ public:
}
void OnClose()
{
m_bConnected = FALSE;
m_bIsClosed = true;
while (m_bIsProcessing)
Sleep(200);
@@ -194,6 +197,9 @@ public:
}
BOOL SayByeBye()
{
if (!m_bConnected) return FALSE;
Mprintf("%s SayByeBye: %s\n", ToPekingTimeAsString(0).c_str(), m_ContextObject->GetPeerName().c_str());
BYTE bToken = COMMAND_BYE;
return m_ContextObject->Send2Client(&bToken, 1);
}

View File

@@ -166,6 +166,7 @@ BEGIN_MESSAGE_MAP(CScreenSpyDlg, CDialog)
ON_WM_ACTIVATE()
ON_WM_TIMER()
ON_COMMAND(ID_EXIT_FULLSCREEN, &CScreenSpyDlg::OnExitFullscreen)
ON_MESSAGE(WM_DISCONNECT, &CScreenSpyDlg::OnDisconnect)
END_MESSAGE_MAP()
@@ -272,7 +273,7 @@ VOID CScreenSpyDlg::OnClose()
m_aviFile = "";
m_aviStream.Close();
}
if (SayByeBye()) Sleep(500);
if (ShouldReconnect() && SayByeBye()) Sleep(500);
CancelIO();
// 恢复鼠标状态
SetClassLongPtr(m_hWnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_ARROW));
@@ -294,6 +295,11 @@ VOID CScreenSpyDlg::OnClose()
DialogBase::OnClose();
}
afx_msg LRESULT CScreenSpyDlg::OnDisconnect(WPARAM wParam, LPARAM lParam) {
m_bConnected = FALSE;
return S_OK;
}
VOID CScreenSpyDlg::OnReceiveComplete()
{
if (m_bIsClosed) return;
@@ -746,7 +752,7 @@ BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg)
void CScreenSpyDlg::SendScaledMouseMessage(MSG* pMsg, bool makeLP)
{
if (!m_bIsCtrl)
if (!m_bIsCtrl || !m_bConnected)
return;
MYMSG msg(*pMsg);

View File

@@ -123,6 +123,7 @@ public:
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
afx_msg LRESULT OnDisconnect(WPARAM wParam, LPARAM lParam);
afx_msg void OnExitFullscreen() {
LeaveFullScreen();
}

View File

@@ -92,6 +92,7 @@
#define WM_ANTI_BLACKSCREEN WM_USER+3029
#define WM_UPDATE_ACTIVEWND WM_USER+3030
#define WM_SHOWNOTIFY WM_USER+3031
#define WM_DISCONNECT WM_USER+3032
#ifdef _UNICODE
#if defined _M_IX86