From 1d875ddbd1605094cae0cf5d1ee3a0de43bafe0a Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Thu, 29 Oct 2026 22:06:33 +0100 Subject: [PATCH] Feature: Add a "Copy Name" item to the online host context menu The online list already lets an operator copy everything about a host through "Copy Client Info", but there was no quick way to grab just the names, which is what people actually paste into a chat or a ticket. The new menu item sits directly below "Edit Group" and copies the names of all selected hosts to the clipboard, separated by semicolons. "Name" means what the first column of the list shows: the remark when one has been set, otherwise the computer name. The column text is CP_ACP, so the handler decodes it the same way OnGetdispinfo does; that keeps the copied text identical to what is on screen, including for Chinese remarks. Clipboard writing reuses the existing UTF-8 based SetClipboardText helper instead of growing a third copy of the same CF_UNICODETEXT code. The item also gets its own 16x16 icon (two stacked cards with text bars, drawn on the usual 240,240,240 background) loaded into a newly added m_bmOnline[75] slot, and translations were added for English, German and Traditional Chinese so the item does not fall back to simplified Chinese when another UI language is active. The user manual and the resource README were updated to match. Co-Authored-By: deepseek-flash --- docs/UserManual.md | 1 + server/2015Remote/2015Remote.rc | Bin 179798 -> 180094 bytes server/2015Remote/2015RemoteDlg.cpp | 38 ++++++++++++++++++++++ server/2015Remote/2015RemoteDlg.h | 3 +- server/2015Remote/lang/de_DE.ini | 1 + server/2015Remote/lang/en_US.ini | 1 + server/2015Remote/lang/zh_TW.ini | 1 + server/2015Remote/res/Bitmap/CopyName.bmp | Bin 0 -> 822 bytes server/2015Remote/res/README.md | 1 + server/2015Remote/resource.h | 6 ++-- 10 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 server/2015Remote/res/Bitmap/CopyName.bmp diff --git a/docs/UserManual.md b/docs/UserManual.md index ffec1f2..6b3767c 100644 --- a/docs/UserManual.md +++ b/docs/UserManual.md @@ -69,6 +69,7 @@ YAMA 主界面由以下部分组成: | 执行程序 | 下载执行、上传执行 | | 修改备注 | 编辑主机备注 | | 修改分组 | 更改所属分组 | +| 复制名称 | 复制选中主机的名称(有备注取备注),多选时用分号分隔 | > **注意**:文件管理、远程终端、进程管理等功能通过**工具栏图标**打开 diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc index 070979d615d3764408a7b1c5d4da6281f0565996..a742ce4444fe92a3cb61f259d7d263ee5fb951b1 100644 GIT binary patch delta 97 zcmccihwI-zu7)j)lkTzeMw$ijhJ2WQQH{xT`hmNQBAm_){tN*Okqq(E&t7CS+&<|Z yc^1CkUO2xg-LXBkIaVc&o(m^Z~*}N#38N# delta 23 fcmezOkL%hWu7)j)lkRPoxzD)d%J#S|ObXlppL7eU diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp index 8f6e4df..d135e14 100644 --- a/server/2015Remote/2015RemoteDlg.cpp +++ b/server/2015Remote/2015RemoteDlg.cpp @@ -746,6 +746,7 @@ CMy2015RemoteDlg::CMy2015RemoteDlg(CWnd* pParent): CDialogLangEx(CMy2015RemoteDl m_bmOnline[72].LoadBitmap(IDB_BITMAP_PREVIEW_QUALITY); // 高级→屏幕预览质量等级 m_bmOnline[73].LoadBitmap(IDB_BITMAP_FILE_SPEED); // 高级→文件传输速度 m_bmOnline[74].LoadBitmap(IDB_BITMAP_DISCLAIMER); // 其他→免责声明 + m_bmOnline[75].LoadBitmap(IDB_BITMAP_COPYNAME); // 右键→复制名称 for (int i = 0; i < PAYLOAD_MAXTYPE; i++) { m_ServerDLL[i] = nullptr; m_ServerBin[i] = nullptr; @@ -1122,6 +1123,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx) ON_MESSAGE(WM_SPLITTER_MOVED, &CMy2015RemoteDlg::OnSplitterMoved) ON_MESSAGE(WM_SPLITTER_RELEASED, &CMy2015RemoteDlg::OnSplitterReleased) ON_COMMAND(ID_COPY_CLIENT_INFO, &CMy2015RemoteDlg::OnCopyClientInfo) + ON_COMMAND(ID_ONLINE_COPY_NAME, &CMy2015RemoteDlg::OnOnlineCopyName) ON_COMMAND(ID_ONLINE_ACTIVE_WND, &CMy2015RemoteDlg::OnOnlineActiveWnd) ON_COMMAND(ID_ONLINE_VIEW_WND, &CMy2015RemoteDlg::OnOnlineWindowManager) ON_COMMAND(ID_ENABLE_DEV_DEBUG, &CMy2015RemoteDlg::OnEnableDevDebug) @@ -4596,6 +4598,7 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult) Menu.SetMenuItemBitmaps(ID_ONLINE_UNINSTALL, MF_BYCOMMAND, &m_bmOnline[15], &m_bmOnline[15]); Menu.SetMenuItemBitmaps(ID_ONLINE_PRIVATE_SCREEN, MF_BYCOMMAND, &m_bmOnline[16], &m_bmOnline[16]); Menu.SetMenuItemBitmaps(ID_ONLINE_REGROUP, MF_BYCOMMAND, &m_bmOnline[17], &m_bmOnline[17]); + Menu.SetMenuItemBitmaps(ID_ONLINE_COPY_NAME, MF_BYCOMMAND, &m_bmOnline[75], &m_bmOnline[75]); Menu.SetMenuItemBitmaps(ID_ONLINE_INJ_NOTEPAD, MF_BYCOMMAND, &m_bmOnline[18], &m_bmOnline[18]); Menu.SetMenuItemBitmaps(ID_PROXY_PORT, MF_BYCOMMAND, &m_bmOnline[19], &m_bmOnline[19]); // Session management icons (shutdown/reboot/logout) @@ -13474,6 +13477,41 @@ void CMy2015RemoteDlg::OnCopyClientInfo() CloseClipboard(); } +// 右键→复制名称:把选中主机的名称写进剪贴板(多选用分号连接)。 +// "名称"就是列表第一列显示的内容——有备注取备注,否则取计算机名;列数据是 CP_ACP +// 的 CString,和 OnGetdispinfo 用同一套解码方式,保证复制到的文字与屏幕一致。 +void CMy2015RemoteDlg::OnOnlineCopyName() +{ + std::wstring names; + EnterCriticalSection(&m_cs); + int nItem = m_CList_Online.GetNextItem(-1, LVNI_SELECTED); + while (nItem != -1) { + context* ctx = GetContextByListIndex(nItem); + if (ctx) { + CString note = m_ClientMap->GetClientMapData(ctx->GetClientID(), MAP_NOTE); + CString text = !note.IsEmpty() ? note : ctx->GetClientData(ONLINELIST_COMPUTER_NAME); + int wlen = text.IsEmpty() ? 0 : MultiByteToWideChar(CP_ACP, 0, text, -1, NULL, 0); + if (wlen > 1) { + std::wstring w(wlen - 1, L'\0'); + MultiByteToWideChar(CP_ACP, 0, text, -1, &w[0], wlen); + if (!names.empty()) names += L';'; + names += w; + } + } + nItem = m_CList_Online.GetNextItem(nItem, LVNI_SELECTED); + } + LeaveCriticalSection(&m_cs); + + if (names.empty()) return; + + // 复用本文件已有的 UTF-8 版剪贴板写入,不再造第三份 CF_UNICODETEXT 代码 + int len = WideCharToMultiByte(CP_UTF8, 0, names.c_str(), (int)names.size(), NULL, 0, NULL, NULL); + if (len <= 0) return; + std::string utf8(len, '\0'); + WideCharToMultiByte(CP_UTF8, 0, names.c_str(), (int)names.size(), &utf8[0], len, NULL, NULL); + SetClipboardText(utf8.c_str()); +} + void CMy2015RemoteDlg::OnOnlineActiveWnd() { POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition(); diff --git a/server/2015Remote/2015RemoteDlg.h b/server/2015Remote/2015RemoteDlg.h index ac4de37..63d923d 100644 --- a/server/2015Remote/2015RemoteDlg.h +++ b/server/2015Remote/2015RemoteDlg.h @@ -453,7 +453,7 @@ public: bool IsDllRequestLimited(const std::string& ip); void RecordDllRequest(const std::string& ip); CMenu m_MainMenu; - CBitmap m_bmOnline[75]; + CBitmap m_bmOnline[76]; uint64_t m_superID; std::map m_RemoteWnds; FileTransformCmd m_CmdList; @@ -725,6 +725,7 @@ public: afx_msg LRESULT OnSplitterMoved(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnSplitterReleased(WPARAM wParam, LPARAM lParam); afx_msg void OnCopyClientInfo(); + afx_msg void OnOnlineCopyName(); afx_msg void OnOnlineActiveWnd(); afx_msg void OnEnableDevDebug(); afx_msg void OnOnlineClientLog(); diff --git a/server/2015Remote/lang/de_DE.ini b/server/2015Remote/lang/de_DE.ini index 0482304..36800e5 100644 --- a/server/2015Remote/lang/de_DE.ini +++ b/server/2015Remote/lang/de_DE.ini @@ -387,6 +387,7 @@ Rar ; ============================================ Ð޸ı¸ע=Notiz bearbeiten Ð޸ķÖ×é=Gruppe bearbeiten +¸´ÖÆÃû³Æ=Namen kopieren Ìí¼ӹØע=Ueberwachung hinzufuegen ¿ͻ§¹ÜÀí=Clientverwaltung תÒÆÖ÷»ú=Host uebertragen diff --git a/server/2015Remote/lang/en_US.ini b/server/2015Remote/lang/en_US.ini index 6d0d196..4003063 100644 --- a/server/2015Remote/lang/en_US.ini +++ b/server/2015Remote/lang/en_US.ini @@ -390,6 +390,7 @@ Rar ; ============================================ Ð޸ı¸ע=Edit Note Ð޸ķÖ×é=Edit Group +¸´ÖÆÃû³Æ=Copy Name Ìí¼ӹØע=Add Watch ¿ͻ§¹ÜÀí=Client Mgmt תÒÆÖ÷»ú=Transfer Host diff --git a/server/2015Remote/lang/zh_TW.ini b/server/2015Remote/lang/zh_TW.ini index e0ff1b0..dedbf81 100644 --- a/server/2015Remote/lang/zh_TW.ini +++ b/server/2015Remote/lang/zh_TW.ini @@ -390,6 +390,7 @@ Rar ; ============================================ Ð޸ı¸ע=Ð޸ĂäÔ] Ð޸ķÖ×é=Ð޸ÄȺ½M +¸´ÖÆÃû³Æ=Ñ}ÑuÃû·Q Ìí¼ӹØע=ÐÂÔöêPע ¿ͻ§¹ÜÀí=ÓÑô¹ÜÀí תÒÆÖ÷»ú=ÞDÒÆÖ÷™C diff --git a/server/2015Remote/res/Bitmap/CopyName.bmp b/server/2015Remote/res/Bitmap/CopyName.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6404175530e4be996968994283a36813c3374dc7 GIT binary patch literal 822 zcmZ?rHDhJ~12Z700mK4O%*Y@C7H0s;3v)v-M1X