@@ -47,20 +47,7 @@ LRESULT window::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHan
4747 }
4848 }*/
4949
50- if (!m_NotifyIconData.cbSize )
51- {
52- m_NotifyIconData.cbSize = NOTIFYICONDATAA_V1_SIZE;
53- m_NotifyIconData.hWnd = m_hWnd;
54- m_NotifyIconData.uID = 1 ;
55- m_NotifyIconData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
56- m_NotifyIconData.uCallbackMessage = WM_SYSTEMTRAYICON;
57- m_NotifyIconData.hIcon = AtlLoadIconImage (IDR_MAINFRAME, LR_DEFAULTCOLOR, GetSystemMetrics (SM_CXSMICON), GetSystemMetrics (SM_CYSMICON));
58- ATL::CString sWindowText ;
59- GetWindowText (sWindowText );
60- _tcscpy_s (m_NotifyIconData.szTip , sWindowText );
61- }
62-
63- Shell_NotifyIcon (NIM_ADD, &m_NotifyIconData);
50+ this ->addTrayIcon ();
6451 ShowWindow (SW_HIDE);
6552
6653 bHandled = TRUE ;
@@ -119,6 +106,26 @@ LRESULT window::OnSystemTrayExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWnd
119106 return 0 ;
120107}
121108
109+ int window::addTrayIcon ()
110+ {
111+ if (!m_NotifyIconData.cbSize )
112+ {
113+ m_NotifyIconData.cbSize = NOTIFYICONDATAA_V1_SIZE;
114+ m_NotifyIconData.hWnd = m_hWnd;
115+ m_NotifyIconData.uID = 1 ;
116+ m_NotifyIconData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
117+ m_NotifyIconData.uCallbackMessage = WM_SYSTEMTRAYICON;
118+ m_NotifyIconData.hIcon = AtlLoadIconImage (IDR_MAINFRAME, LR_DEFAULTCOLOR, GetSystemMetrics (SM_CXSMICON), GetSystemMetrics (SM_CYSMICON));
119+ ATL::CString sWindowText ;
120+ GetWindowText (sWindowText );
121+ _tcscpy_s (m_NotifyIconData.szTip , sWindowText );
122+ }
123+
124+ Shell_NotifyIcon (NIM_ADD, &m_NotifyIconData);
125+
126+ return 0 ;
127+ }
128+
122129LRESULT window::OnFileRefreshlist (WORD /* wNotifyCode*/ , WORD /* wID*/ , HWND /* hWndCtl*/ , BOOL& /* bHandled*/ )
123130{
124131 if (!this ->dlg_main_b )
@@ -132,7 +139,7 @@ LRESULT window::OnFileRefreshlist(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWn
132139LRESULT window::OnAbout (WORD /* wNotifyCode*/ , WORD /* wID*/ , HWND /* hWndCtl*/ , BOOL& /* bHandled*/ )
133140{
134141 this ->MessageBoxW (
135- L" Audio Router version 0.10.4 .\n " \
142+ L" Audio Router version 0.10.5 .\n " \
136143 L" \n If you come across any bugs(especially relating to routing or duplicating), " \
137144 L" or just have an idea for a new feature, " \
138145 L" please open an issue on github: github.com/a-sync/audio-router/" ,
0 commit comments