mirror of
https://github.com/yuanyuanxiang/SimpleRemoter.git
synced 2026-01-22 07:14:15 +08:00
Fix/Improve: fix #267 and scale 4K desktop screen to 1080P
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user