| Home | Table of Contents | Please view with Internet Explorer (version 5.00 or higher) and enable scripting. For reasons, see Browsing This Web Site. |
CURRENT WORK ITEM - PREVIEW ONLY
This structure provides input to the Shell_NotifyIcon function.
typedef struct _NOTIFYICONDATA {
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
TCHAR szTip [128];
DWORD dwState;
DWORD dwStateMask;
TCHAR szInfo [256];
union {
UINT uTimeout;
UINT uVersion;
};
TCHAR szInfoTitle [64];
DWORD dwInfoFlags;
GUID guidItem;
} NOTIFYICONDATA, *PNOTIFYICONDATA;
The structure has both ANSI and Unicode forms.
Interpretation varies with the dwMessage argument given to Shell_NotifyIcon. The first three members are required in all cases. The remaining members are ignored if dwMessage is either NIM_DELETE or NIM_SETFOCUS. When dwMessage is NIM_SETVERSION, only uVersion is meaningful (and it is required). For NIM_ADD and NIM_MODIFY, the uFlags member is required but the members that follow it are optional.
The cbSize member gives the size of the structure in bytes. For the structure as shown above, this should be 0x01F8 in the ANSI form and 0x03B8 in the Unicode. However, the structure has progressed through SHELL32 versions by expansion, so that other sizes are taken to indicate older versions in which some of the members shown above are not defined. Details are presently beyond the scope of these notes.
The hWnd and uID members identify the target icon by associating it with a window and providing a per-window identification number. The window is effectively the owner of the icon, which leases space in the taskbar’s notification area. The ID is this owner’s context data for the icon.
When dwMessage is NIM_ADD or NIM_MODIFY, bits in uFlags indicate which of the remaining members are set.
| NIF_MESSAGE | 0x01 | the uCallbackMessage member is set |
| NIF_ICON | 0x02 | the hIcon member is set |
| NIF_TIP | 0x04 | the szTip member is set |
| NIF_STATE | 0x08 | the dwState and dwStateMask members are set |
| NIF_INFO | 0x10 | the szInfo, uTimeout, szInfoTitle and dwInfoFlags members are set |
| NIF_GUID | 0x20 | the guidItem member is set |
The uCallbackMessage member specifies the window message that is to be sent to the owner window when the taskbar window learns of events that affect the icon.
The hIcon member ...
The szTip member ...
The dwState and dwStateMask members ...
| NIS_HIDDEN | 0x01 | |
| NIF_SHAREDICON | 0x02 | |
| undocumented | 0x20000000 | valid only in dwStateMask and only if
dwMessage is NIM_ADD;
set “always show” for icon if no state persists from registry |
The szInfo member ...
The uTimeout member ...
When dwMessage is NIM_SETVERSION, the uTimeout member is reinterpreted as uVersion. The expected values are 0 and 3, representing old and new behaviour respectively. Anything below 3 is treated as 0. Anything above 3 is invalid. The difference between old and new behaviour is presently beyond the scope of these notes.
The szInfoTitle member ...
The dwInfoFlags member ...
The guidItem member provides a GUID to save with the icon’s persistent data stream, presumably to help retrieve the right state for the right icon in future sessions. Note however that although this GUID is so saved, it is not presently checked when recovering any persistent icon state.