添加:
NOTIFYICONDATA notifyIcon.hWnd = GetSafeHwnd(); // 視窗句柄
notifyIcon.uCallbackMessage = WM_UM_TRAYNOTIFY; // 回調事件
notifyIcon.hIcon = m_hIcon; // 顯示圖示
// Set tray notification tip information
CString strToolTip = _T("xxxx");
_tcsncpy_s(notifyIcon.szTip, strToolTip, strToolTip.GetLength());
::Shell_NotifyIcon(NIM_ADD, notifyIcon);
移除:
notifyIcon.hIcon=NULL;
Shell_NotifyIcon(NIM_DELETE,notifyIcon);