xp下实现托盘图标以及冒泡提示

时间:2012-04-02 06:15:53
【文件属性】:

文件名称:xp下实现托盘图标以及冒泡提示

文件大小:29KB

文件格式:RAR

更新时间:2012-04-02 06:15:53

托盘 冒泡

xp下要实现托盘图标需要更新SDK,但为了这个似乎有点小题大做了,网上有解决办法,说是要改_WIN32_IE的值,但仅这些不够,我们还要将新版的shellapi.h覆盖旧版的就可以了,没有必要所有文件都更新的。新旧版比对只需要更改一下结构体的定义: //////////////////////////////修改的地方开始/////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// //// //// Tray notification definitions //// typedef struct _NOTIFYICONDATAA { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; #if (_WIN32_IE < 0x0500) CHAR szTip[64]; #else CHAR szTip[128]; #endif #if (_WIN32_IE >= 0x0500) DWORD dwState; DWORD dwStateMask; CHAR szInfo[256]; union { UINT uTimeout; UINT uVersion; } DUMMYUNIONNAME; CHAR szInfoTitle[64]; DWORD dwInfoFlags; #endif #if (_WIN32_IE >= 0x600) GUID guidItem; #endif } NOTIFYICONDATAA, *PNOTIFYICONDATAA; typedef struct _NOTIFYICONDATAW { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; #if (_WIN32_IE < 0x0500) WCHAR szTip[64]; #else WCHAR szTip[128]; #endif #if (_WIN32_IE >= 0x0500) DWORD dwState; DWORD dwStateMask; WCHAR szInfo[256]; union { UINT uTimeout; UINT uVersion; } DUMMYUNIONNAME; WCHAR szInfoTitle[64]; DWORD dwInfoFlags; #endif #if (_WIN32_IE >= 0x600) GUID guidItem; #endif } NOTIFYICONDATAW, *PNOTIFYICONDATAW; #ifdef UNICODE typedef NOTIFYICONDATAW NOTIFYICONDATA; typedef PNOTIFYICONDATAW PNOTIFYICONDATA; #else typedef NOTIFYICONDATAA NOTIFYICONDATA; typedef PNOTIFYICONDATAA PNOTIFYICONDATA; #endif // UNICODE #define NOTIFYICONDATAA_V1_SIZE FIELD_OFFSET(NOTIFYICONDATAA, szTip[64]) #define NOTIFYICONDATAW_V1_SIZE FIELD_OFFSET(NOTIFYICONDATAW, szTip[64]) #ifdef UNICODE #define NOTIFYICONDATA_V1_SIZE NOTIFYICONDATAW_V1_SIZE #else #define NOTIFYICONDATA_V1_SIZE NOTIFYICONDATAA_V1_SIZE #endif #define NOTIFYICONDATAA_V2_SIZE FIELD_OFFSET(NOTIFYICONDATAA, guidItem) #define NOTIFYICONDATAW_V2_SIZE FIELD_OFFSET(NOTIFYICONDATAW, guidItem) #ifdef UNICODE #define NOTIFYICONDATA_V2_SIZE NOTIFYICONDATAW_V2_SIZE #else #define NOTIFYICONDATA_V2_SIZE NOTIFYICONDATAA_V2_SIZE #endif #if (_WIN32_IE >= 0x0500) #define NIN_SELECT (WM_USER + 0) #define NINF_KEY 0x1 #define NIN_KEYSELECT (NIN_SELECT | NINF_KEY) #endif #if (_WIN32_IE >= 0x0501) #define NIN_BALLOONSHOW (WM_USER + 2) #define NIN_BALLOONHIDE (WM_USER + 3) #define NIN_BALLOONTIMEOUT (WM_USER + 4) #define NIN_BALLOONUSERCLICK (WM_USER + 5) #endif #define NIM_ADD 0x00000000 #define NIM_MODIFY 0x00000001 #define NIM_DELETE 0x00000002 #if (_WIN32_IE >= 0x0500) #define NIM_SETFOCUS 0x00000003 #define NIM_SETVERSION 0x00000004 #define NOTIFYICON_VERSION 3 #endif #define NIF_MESSAGE 0x00000001 #define NIF_ICON 0x00000002 #define NIF_TIP 0x00000004 #if (_WIN32_IE >= 0x0500) #define NIF_STATE 0x00000008 #define NIF_INFO 0x00000010 #endif #if (_WIN32_IE >= 0x600) #define NIF_GUID 0x00000020 #endif #if (_WIN32_IE >= 0x0500) #define NIS_HIDDEN 0x00000001 #define NIS_SHAREDICON 0x00000002 // says this is the source of a shared icon // Notify Icon Infotip flags #define NIIF_NONE 0x00000000 // icon flags are mutually exclusive // and take only the lowest 2 bits #define NIIF_INFO 0x00000001 #define NIIF_WARNING 0x00000002 #define NIIF_ERROR 0x00000003 #define NIIF_ICON_MASK 0x0000000F #if (_WIN32_IE >= 0x0501) #define NIIF_NOSOUND 0x00000010 #endif #endif SHSTDAPI_(BOOL) Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA lpData); SHSTDAPI_(BOOL) Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW lpData); #ifdef UNICODE #define Shell_NotifyIcon Shell_NotifyIconW #else #define Shell_NotifyIcon Shell_NotifyIconA #endif // !UNICODE //// //// End Tray Notification Icons //// ///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////


【文件预览】:
TrayIconTool
----TrayIconToolDlg.cpp(7KB)
----TrayIconTool.h(1KB)
----StdAfx.cpp(214B)
----TrayIcon.h(1KB)
----TrayIconTool.rc(6KB)
----TrayIconTool.opt(50KB)
----TrayIconToolDlg.h(2KB)
----TrayIconTool.aps(42KB)
----TrayIcon.cpp(2KB)
----TrayIconTool.plg(3KB)
----ReadMe.txt(4KB)
----StdAfx.h(1KB)
----TrayIconTool.cpp(2KB)
----TrayIconTool.dsp(4KB)
----Resource.h(1KB)
----res()
--------TrayIconTool.rc2(404B)
--------myicon2.ico(2KB)
--------GOOFY.ICO(3KB)
--------myicon.ico(766B)
--------TrayIconTool.ico(1KB)
----TrayIconTool.clw(1KB)
----TrayIconTool.dsw(532B)

网友评论

  • 不错的资料,不过用起来有一点点问题,在vc6中能够编译出来并提示泡泡,可是 在vs中编译却没有提示,不知道是为什么 ?希望大家探讨下。