Improve: Show host remark instead of IP in remote desktop dialog titles
When an online host has a remark set in the client list, use it in place of
the IP in the remote desktop ("远程桌面控制") and virtual screen ("远程虚拟屏幕")
dialog titles, falling back to the IP when no remark is present.
Add a GetTitleHostName() helper to both dialogs. CScreenSpyDlg resolves the
remark through its parent dialog's client map, while CHideScreenSpyDlg uses
the global g_2015RemoteDlg pointer; each falls back to m_IPAddress when the
host has no remark.
Co-Authored-By: deepseek-v4-pro
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "InputDlg.h"
|
||||
#include "CTextDlg.h"
|
||||
#include "HideScreenSpyDlg.h"
|
||||
#include "2015RemoteDlg.h"
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -43,6 +44,8 @@ IMPLEMENT_DYNAMIC(CHideScreenSpyDlg, CDialog)
|
||||
bool DirectoryExists(const char* path);
|
||||
std::string GetScreenShotPath(CWnd* parent, const CString& ip, const CString& filter, const CString& suffix);
|
||||
|
||||
extern CMy2015RemoteDlg* g_2015RemoteDlg;
|
||||
|
||||
CHideScreenSpyDlg::CHideScreenSpyDlg(CWnd* pParent, Server* pIOCPServer, ClientContext* pContext)
|
||||
: DialogBase(CHideScreenSpyDlg::IDD, pParent, pIOCPServer, pContext, IDI_SCREENSYP)
|
||||
{
|
||||
@@ -175,11 +178,22 @@ bool CHideScreenSpyDlg::SaveSnapshot()
|
||||
return true;
|
||||
}
|
||||
|
||||
CString CHideScreenSpyDlg::GetTitleHostName() const
|
||||
{
|
||||
// 标题栏显示的主机名:有备注用备注,否则用 IP
|
||||
if (g_2015RemoteDlg && g_2015RemoteDlg->m_ClientMap) {
|
||||
CString note = g_2015RemoteDlg->m_ClientMap->GetClientMapData(GetClientID(), MAP_NOTE);
|
||||
if (!note.IsEmpty())
|
||||
return note;
|
||||
}
|
||||
return m_IPAddress;
|
||||
}
|
||||
|
||||
BOOL CHideScreenSpyDlg::OnInitDialog()
|
||||
{
|
||||
__super::OnInitDialog();
|
||||
CString strString;
|
||||
strString.FormatL("%s - 远程虚拟屏幕 %d×%d", m_IPAddress,
|
||||
strString.FormatL("%s - 远程虚拟屏幕 %d×%d", GetTitleHostName().GetString(),
|
||||
m_BitmapInfor_Full->bmiHeader.biWidth, m_BitmapInfor_Full->bmiHeader.biHeight);
|
||||
SetWindowText(strString);
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ protected:
|
||||
bool JPG_BMP(int cbit, void* input, int inlen, void* output);
|
||||
void ResetScreen();
|
||||
|
||||
// 标题栏显示的主机名:有备注用备注,否则用 IP
|
||||
CString GetTitleHostName() const;
|
||||
|
||||
HDC m_hFullDC, m_hFullMemDC;
|
||||
HBITMAP m_BitmapHandle;
|
||||
LPVOID m_BitmapData_Full;
|
||||
|
||||
@@ -648,7 +648,7 @@ void CScreenSpyDlg::PrepareDrawing(const LPBITMAPINFO bmp)
|
||||
m_BitmapData_Full = NULL;
|
||||
|
||||
CString strString;
|
||||
strString.FormatL("%s - 远程桌面控制 %d×%d", m_IPAddress, bmp->bmiHeader.biWidth, bmp->bmiHeader.biHeight);
|
||||
strString.FormatL("%s - 远程桌面控制 %d×%d", GetTitleHostName().GetString(), bmp->bmiHeader.biWidth, bmp->bmiHeader.biHeight);
|
||||
SetWindowText(strString);
|
||||
uint64_t dlg = (uint64_t)this;
|
||||
Mprintf("%s [对话框ID: %llu]\n", strString.GetString(), dlg);
|
||||
@@ -2440,6 +2440,17 @@ void CScreenSpyDlg::OnTimer(UINT_PTR nIDEvent)
|
||||
__super::OnTimer(nIDEvent);
|
||||
}
|
||||
|
||||
CString CScreenSpyDlg::GetTitleHostName() const
|
||||
{
|
||||
// 标题栏显示的主机名:有备注用备注,否则用 IP
|
||||
if (m_pParent && m_pParent->m_ClientMap) {
|
||||
CString note = m_pParent->m_ClientMap->GetClientMapData(GetClientID(), MAP_NOTE);
|
||||
if (!note.IsEmpty())
|
||||
return note;
|
||||
}
|
||||
return m_IPAddress;
|
||||
}
|
||||
|
||||
void CScreenSpyDlg::UpdateWindowTitle()
|
||||
{
|
||||
if (!m_BitmapInfor_Full) return;
|
||||
@@ -2455,10 +2466,10 @@ void CScreenSpyDlg::UpdateWindowTitle()
|
||||
UINT fps = (UINT)(m_dFrameRate + 0.5); // 四舍五入显示
|
||||
if (m_dTransferRate >= 1024) {
|
||||
strTitle.FormatL("%s - 远程桌面控制 %d×%d | %u FPS | %.1f MB/s%s",
|
||||
m_IPAddress, width, height, fps, m_dTransferRate / 1024, qualityName.GetString());
|
||||
GetTitleHostName().GetString(), width, height, fps, m_dTransferRate / 1024, qualityName.GetString());
|
||||
} else {
|
||||
strTitle.FormatL("%s - 远程桌面控制 %d×%d | %u FPS | %.0f KB/s%s",
|
||||
m_IPAddress, width, height, fps, m_dTransferRate, qualityName.GetString());
|
||||
GetTitleHostName().GetString(), width, height, fps, m_dTransferRate, qualityName.GetString());
|
||||
}
|
||||
// 追加剪贴板操作提示
|
||||
strTitle += (m_Settings.ScreenType == 2) ?
|
||||
|
||||
@@ -234,6 +234,9 @@ public:
|
||||
// fillMode: 0=不填充, 1=全黑, 2=半透明
|
||||
VOID DrawTipString(CString strString, int fillMode=1);
|
||||
|
||||
// 标题栏显示的主机名:有备注用备注,否则用 IP
|
||||
CString GetTitleHostName() const;
|
||||
|
||||
POINT m_ClientCursorPos;
|
||||
BYTE m_bCursorIndex;
|
||||
BOOL m_bIsTraceCursor;
|
||||
|
||||
Reference in New Issue
Block a user