SYSTRAY.C
上传用户:chn_coc
上传日期:2007-12-20
资源大小:563k
文件大小:1k
- // systray.c
- #include <windows.h>
- #define SYSTRAY_ICON_BASE 1024
- BOOL systray_add(HWND hwnd, UINT uID, HICON hIcon, LPSTR lpszTip);
- BOOL systray_del(HWND hwnd, UINT uID);
- BOOL systray_add(HWND hwnd, UINT uID, HICON hIcon, LPSTR lpszTip)
- {
- NOTIFYICONDATA tnid;
- tnid.cbSize = sizeof(NOTIFYICONDATA);
- tnid.hWnd = hwnd;
- tnid.uID = uID+SYSTRAY_ICON_BASE;
- tnid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
- tnid.uCallbackMessage = WM_USER + 27;
- tnid.hIcon = hIcon;
- lstrcpyn(tnid.szTip,lpszTip,sizeof(tnid.szTip)-1);
- return (Shell_NotifyIcon(NIM_ADD, &tnid));
- }
- BOOL systray_del(HWND hwnd, UINT uID) {
- NOTIFYICONDATA tnid;
- tnid.cbSize = sizeof(NOTIFYICONDATA);
- tnid.hWnd = hwnd;
- tnid.uID = uID+SYSTRAY_ICON_BASE;
- return(Shell_NotifyIcon(NIM_DELETE, &tnid));
- }