// MyTaskBarAddIcon - adds an icon to the taskbar status area. // Returns TRUE if successful or FALSE otherwise. // hwnd - handle of the window to receive callback messages // uID - identifier of the icon // hicon - handle of the icon to add // lpszTip - ToolTip text BOOL MyTaskBarAddIcon(HWND hwnd, UINT uID, HICON hicon, LPSTR lpszTip) { BOOL res; NOTIFYICONDATA tnid; tnid.cbSize = sizeof(NOTIFYICONDATA); tnid.hWnd = hwnd; tnid.uID = uID; tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; tnid.uCallbackMessage = MYWM_NOTIFYICON; tnid.hIcon = hicon; if (lpszTip) lstrcpyn(tnid.szTip, lpszTip, sizeof(tnid.szTip)); else tnid.szTip[0] = '\0'; res = Shell_NotifyIcon(NIM_ADD, &tnid); if (hicon) DestroyIcon(hicon); return res; }