Skip to content

Commit 32af6b5

Browse files
committed
如果隐藏了通知区图标,弹出通知后重新隐藏 #1814 #1812 #1811
1 parent e1abbbd commit 32af6b5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

TrafficMonitor/TrafficMonitorDlg.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,6 @@ void CTrafficMonitorDlg::ShowNotifyTip(const wchar_t* title, const wchar_t* mess
598598
{
599599
//添加通知栏图标
600600
AddNotifyIcon();
601-
theApp.m_general_data.show_notify_icon = true;
602601
}
603602
//显示通知提示
604603
m_ntIcon.uFlags |= NIF_INFO;
@@ -608,6 +607,14 @@ void CTrafficMonitorDlg::ShowNotifyTip(const wchar_t* title, const wchar_t* mess
608607
CCommon::WStringCopy(m_ntIcon.szInfoTitle, 64, title);
609608
::Shell_NotifyIcon(NIM_MODIFY, &m_ntIcon);
610609
m_ntIcon.uFlags &= ~NIF_INFO;
610+
611+
//如果不显示通知区域图标,则在弹出通知的一段时间后删除通知区图标
612+
if (!theApp.m_general_data.show_notify_icon)
613+
{
614+
//延迟一定时间后删除通知区图标
615+
KillTimer(DELETE_NOTIFY_ICON_TIMER);
616+
SetTimer(DELETE_NOTIFY_ICON_TIMER, 8000, NULL);
617+
}
611618
}
612619

613620
void CTrafficMonitorDlg::UpdateNotifyIconTip()
@@ -1845,6 +1852,12 @@ void CTrafficMonitorDlg::OnTimer(UINT_PTR nIDEvent)
18451852
}
18461853
}
18471854

1855+
if (nIDEvent == DELETE_NOTIFY_ICON_TIMER)
1856+
{
1857+
DeleteNotifyIcon();
1858+
KillTimer(DELETE_NOTIFY_ICON_TIMER);
1859+
}
1860+
18481861
CDialog::OnTimer(nIDEvent);
18491862
}
18501863

@@ -2054,6 +2067,8 @@ BOOL CTrafficMonitorDlg::OnCommand(WPARAM wParam, LPARAM lParam)
20542067
if (uMsg == ID_CMD_TEST)
20552068
{
20562069
CTest::TestCommand();
2070+
//ShowNotifyTip(CCommon::LoadText(_T("TrafficMonitor "), IDS_NOTIFY), _T("测试通知"));
2071+
20572072
}
20582073
#endif // DEBUG
20592074
//选择了插件命令

TrafficMonitor/stdafx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ using std::ofstream;
8484
#define TASKBAR_TIMER 1236
8585
#define CONNECTION_DETAIL_TIMER 1237
8686
#define MONITOR_TIMER 1238
87+
#define DELETE_NOTIFY_ICON_TIMER 1239 //删除通知区图标的定时器
8788

8889
#define MAX_INSERT_TO_TASKBAR_CNT 200 //尝试嵌入任务栏的最大次数
8990
#define WARN_INSERT_TO_TASKBAR_CNT 20 //尝试嵌入任务栏的警告次数

0 commit comments

Comments
 (0)