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:
yuanyuanxiang
2026-08-20 16:35:43 +02:00
parent c08315cd79
commit 0a1ecfc4ab
4 changed files with 35 additions and 4 deletions

View File

@@ -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);