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

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