Contains information that the system needs to process taskbar status area messages.
typedef struct _NOTIFYICONDATA {
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
#if (_WIN32_IE < 0x0500)
TCHAR szTip[64];
#else
TCHAR szTip[128];
#endif
#if (_WIN32_IE >= 0x0500)
DWORD dwState;
DWORD dwStateMask;
TCHAR szInfo[256];
union {
UINT uTimeout;
UINT uVersion;
} DUMMYUNIONNAME;
TCHAR szInfoTitle[64];
DWORD dwInfoFlags;
#endif
#if (_WIN32_IE >= 0x600)
GUID guidItem;
#endif
} NOTIFYICONDATA, *PNOTIFYICONDATA;
Flag | Description |
---|---|
NIF_ICON | The hIcon member is valid. |
NIF_MESSAGE | The uCallbackMessage member is valid. |
NIF_TIP | The szTip member is valid. |
NIF_STATE | The dwState and dwStateMask members are valid. |
NIF_INFO | Use a balloon ToolTip instead of a standard ToolTip. The szInfo, uTimeout, szInfoTitle, and dwInfoFlags members are valid. |
NIF_GUID | Reserved. |
For Version 5.0 and later, szTip can have a maximum of 128 characters, including the terminating NULL.
Flag | Description |
---|---|
NIS_HIDDEN | The icon is hidden. |
NIS_SHAREDICON | The icon is shared. |
Value | Description |
---|---|
0 | Use the Windows 95 behavior. Use this value for applications designed for Windows versions prior to Windows 2000. |
NOTIFYICON_VERSION | Use the Windows 2000 behavior. Use this value for applications designed for Windows 2000 and later. |
Flag | Description |
---|---|
NIIF_ERROR | An error icon. |
NIIF_INFO | An information icon. |
NIIF_NONE | No icon. |
NIIF_WARNING | A warning icon. |
NIIF_ICON_MASK | Version 6.0. Reserved. |
NIIF_NOSOUND | Version 6.0. Do not play the associated sound. Applies only to balloon ToolTips. |
If you set the NIF_INFO flag in the uFlags member, the standard ToolTip is replaced by a balloon ToolTip. For more discussion of balloon ToolTips, see the ToolTip Controls chapter.
No more than one balloon ToolTip at a time is displayed for the taskbar. If an application attempts to display a ToolTip when one is already being displayed, the ToolTip will not appear until the existing balloon ToolTip has been visible for at least the system minimum timeout value. For example, a balloon ToolTip with uTimeout set to 30 seconds has been visible for seven seconds when another application attempts to display a balloon ToolTip. If the system minimum timeout is ten seconds, the first ToolTip displays for an additional three seconds before being replaced by the second ToolTip.
Note that several members of this structure are only supported for Shell32.dll versions 5.0 and later. To enable these members, include one of the following in your header.
#define _WIN32_IE 0x0500 #define _WIN32_IE 0x0600
However, you must initialize the structure with its size. If you use the size of the currently defined structure, the application may not run with the earlier versions of Shell32.dll, which expect a smaller structure. You can run your application on pre-5.0 versions of Shell32.dll by defining the appropriate version number (see Shell and Common Controls Versions). However, this may cause problems if your application also needs to run on systems with more recent versions.
Your can keep your application compatible with all Shell32.dll versions while still using the current header files by setting the size of the NOTIFYICONDATA structure appropriately. Before initializing the structure, use the DllGetVersion function to determine which Shell32.dll version is installed on the system. If it is version 5.0 or greater, initialize the cbSize member with:
nid.cbSize = sizeof(NOTIFYICONDATA);
Setting cbSize to this value enables all the version 5.0 and 6.0 enhancements. For earlier versions, the size of the pre-6.0 structure is given by the NOTIFYICONDATA_V2_SIZE constant and the pre-5.0 structure is given by the NOTIFYICONDATA_V1_SIZE constant. Initialize the cbSize member with:
nid.cbSize = NOTIFYICONDATA_V2_SIZE;
Using this value for cbSize enables your application to use NOTIFYICONDATA with earlier Shell32.dll versions, although without the version 6.0 enhancements.
Version 4.00 and later of Shell32.dll
Windows NT/2000: Requires Windows NT 4.0 or later.