任务栏 图标


BOOL AddTaskBarIcon(HWND hwnd, UINT uID, UINT uMsg, HICON hicon, LPCTSTR lpszTip)
{
 NOTIFYICONDATA tnid;

 tnid.cbSize = sizeof(NOTIFYICONDATA);
 tnid.hWnd   = hwnd;
 tnid.uID    = uID;
 tnid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
 tnid.uCallbackMessage = uMsg;
 tnid.hIcon  = hicon;

 if (lpszTip)
  _tcsncpy(tnid.szTip, lpszTip, (( sizeof(tnid.szTip) / sizeof(tnid.szTip[0]) ) - 1) );
 else
  tnid.szTip[0]='\0';

 return Shell_NotifyIcon(NIM_ADD, &tnid);
}

BOOL DeleteTaskBarIcon(HWND hwnd, UINT uID)
{
 NOTIFYICONDATA tnid;
 tnid.cbSize = sizeof(NOTIFYICONDATA);
 tnid.hWnd   = hwnd;
 tnid.uID    = uID;
 return Shell_NotifyIcon(NIM_DELETE, &tnid);
}

你可能感兴趣的:(任务栏 图标)