diff --git a/TrafficMonitor/TaskBarDlg.cpp b/TrafficMonitor/TaskBarDlg.cpp index 4ad7a85..3587b28 100644 --- a/TrafficMonitor/TaskBarDlg.cpp +++ b/TrafficMonitor/TaskBarDlg.cpp @@ -41,6 +41,7 @@ BEGIN_MESSAGE_MAP(CTaskBarDlg, CDialogEx) ON_WM_PAINT() ON_WM_CLOSE() ON_WM_LBUTTONUP() + ON_MESSAGE(WM_EXITMENULOOP, &CTaskBarDlg::OnExitmenuloop) END_MESSAGE_MAP() @@ -1010,7 +1011,8 @@ void CTaskBarDlg::OnCancel() void CTaskBarDlg::OnRButtonUp(UINT nFlags, CPoint point) { // TODO: 在此添加消息处理程序代码和/或调用默认值 - + m_menu_popuped = true; + m_tool_tips.Pop(); CheckClickedItem(point); if (m_clicked_item.is_plugin && m_clicked_item.plugin_item != nullptr) { @@ -1075,7 +1077,7 @@ BOOL CTaskBarDlg::PreTranslateMessage(MSG* pMsg) if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE) return TRUE; if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) return TRUE; - if (theApp.m_taskbar_data.show_tool_tip && IsWindow(m_tool_tips.GetSafeHwnd()) && (pMsg->message == WM_LBUTTONDOWN || + if (theApp.m_taskbar_data.show_tool_tip && !m_menu_popuped && IsWindow(m_tool_tips.GetSafeHwnd()) && (pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP || pMsg->message == WM_MOUSEMOVE)) { @@ -1281,3 +1283,10 @@ void CTaskBarDlg::OnLButtonUp(UINT nFlags, CPoint point) CDialogEx::OnLButtonUp(nFlags, point); } + + +afx_msg LRESULT CTaskBarDlg::OnExitmenuloop(WPARAM wParam, LPARAM lParam) +{ + m_menu_popuped = false; + return 0; +} diff --git a/TrafficMonitor/TaskBarDlg.h b/TrafficMonitor/TaskBarDlg.h index d28b231..5d99e7e 100644 --- a/TrafficMonitor/TaskBarDlg.h +++ b/TrafficMonitor/TaskBarDlg.h @@ -94,6 +94,7 @@ protected: bool m_connot_insert_to_task_bar{ false }; //如果窗口无法嵌入任务栏,则为true bool m_taskbar_on_top_or_bottom{ true }; //如果任务栏在屏幕顶部或底部,则为ture int m_error_code{}; + bool m_menu_popuped{ false }; //指示当前是否有菜单处于弹出状态 CFont m_font; //字体 @@ -163,4 +164,6 @@ public: afx_msg void OnPaint(); afx_msg void OnClose(); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); +protected: + afx_msg LRESULT OnExitmenuloop(WPARAM wParam, LPARAM lParam); };