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
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-10-29 22:06:33 +01:00
1 parent dcb5ae25c6
commit 1d875ddbd1
10 files changed
+49 -3

No files matched your search

+1
View File
@@ -69,6 +69,7 @@ YAMA 主界面由以下部分组成:
| 执行程序 | 下载执行、上传执行 |
| 修改备注 | 编辑主机备注 |
| 修改分组 | 更改所属分组 |
| 复制名称 | 复制选中主机的名称(有备注取备注),多选时用分号分隔 |
> **注意**:文件管理、远程终端、进程管理等功能通过**工具栏图标**打开
Binary file not shown.
+38
View File
@@ -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();
+2 -1
View File
@@ -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<HWND, CDialogBase *> 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();
+1
View File
@@ -387,6 +387,7 @@ Rar
; ============================================
修改备注=Notiz bearbeiten
修改分组=Gruppe bearbeiten
复制名称=Namen kopieren
添加关注=Ueberwachung hinzufuegen
客户管理=Clientverwaltung
转移主机=Host uebertragen
+1
View File
@@ -390,6 +390,7 @@ Rar
; ============================================
修改备注=Edit Note
修改分组=Edit Group
复制名称=Copy Name
添加关注=Add Watch
客户管理=Client Mgmt
转移主机=Transfer Host
+1
View File
@@ -390,6 +390,7 @@ Rar
; ============================================
修改备注=修改備註
修改分组=修改群組
复制名称=複製名稱
添加关注=新增關注
客户管理=用戶管理
转移主机=轉移主機
Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

+1
View File
@@ -64,6 +64,7 @@ res/
|--------|------|----------|
| `note.bmp` | 修改备注 | 右键菜单 |
| `EditGroup.bmp` | 修改分组 | 右键菜单 |
| `CopyName.bmp` | 复制名称 | 右键菜单 |
| `AddWatch.bmp` | 添加关注 | 右键菜单 |
| `LoginNotify.bmp` | 上线提醒 | 右键菜单 |
| `AdminRun.bmp` | 直接执行代码 | 右键菜单 |
+4 -2
View File
@@ -295,6 +295,7 @@
#define IDB_BITMAP_PREVIEW_QUALITY 413
#define IDB_BITMAP_FILE_SPEED 414
#define IDB_BITMAP_DISCLAIMER 415
#define IDB_BITMAP_COPYNAME 416
#define IDC_MESSAGE 1000
#define IDC_ONLINE 1001
#define IDC_STATIC_TIPS 1002
@@ -1111,14 +1112,15 @@
#define ID_EXPERIMENT_TLS_ENABLE 33094
#define ID_EXPERIMENT_TLS_DISABLE 33095
#define ID_MSGLOG_WHITELIST_IP 33096
#define ID_ONLINE_COPY_NAME 33097
#define ID_EXIT_FULLSCREEN 40001
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 416
#define _APS_NEXT_COMMAND_VALUE 33097
#define _APS_NEXT_RESOURCE_VALUE 417
#define _APS_NEXT_COMMAND_VALUE 33098
#define _APS_NEXT_CONTROL_VALUE 2621
#define _APS_NEXT_SYMED_VALUE 105
#endif