添加:
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);