Posted on 2010-02-14 23:34
S.l.e!ep.¢% 阅读(195)
评论(0) 编辑 收藏 引用 所属分类:
VC
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);
}