From ca6f76565c4a19c50d84e66f5651a7e2ddf2fff0 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Sat, 10 Oct 2026 14:39:34 +0200 Subject: [PATCH] Change: Hide client chat dialog on close instead of terminating Closing the client-side chat dialog (via the "end chat" button or the title-bar X) now only hides the window and keeps the session alive, instead of destroying it. Closing the chat stays server-initiated: the next message from the server reopens the hidden dialog via the existing SW_RESTORE path in OnReceive, and the dialog is only truly destroyed on COMMAND_CHAT_CLOSE or connection close. Co-Authored-By: deepseek-v4-pro --- client/ChatManager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/ChatManager.cpp b/client/ChatManager.cpp index cd1a405..54235fc 100644 --- a/client/ChatManager.cpp +++ b/client/ChatManager.cpp @@ -245,14 +245,17 @@ INT_PTR CALLBACK CChatManager::ChatDialogProc(HWND hDlg, UINT uMsg, WPARAM wPara return TRUE; } if (LOWORD(wParam) == IDC_BUTTON_END) { - // 被控端主动结束交谈:关闭本地聊天窗口 - SendMessage(hDlg, WM_USER + 1, NULL, NULL); + // 被控端关闭聊天窗口:仅隐藏对话框,会话保持。关闭交谈始终由服务端发起, + // 服务端继续发消息时 OnReceive 会用 SW_RESTORE 重新弹出本对话框。 + ShowWindow(hDlg, SW_HIDE); return TRUE; } break; case WM_CLOSE: - return 0; + // X 关闭按钮:仅隐藏对话框(与「结束交谈」一致),关闭交谈始终由服务端发起 + ShowWindow(hDlg, SW_HIDE); + return TRUE; case WM_USER + 1: pThis->m_hWnd = NULL;