中易网

请教结构体NOTIFYICONDATA的具体介绍

答案:1  悬赏:50  
解决时间 2021-02-12 12:50
请教结构体NOTIFYICONDATA的具体介绍
最佳答案
不装MSDN可以在微软网站查询。

Contains information that the system needs to process taskbar status area messages.

Syntax

typedef struct _NOTIFYICONDATA {
DWORD cbSize;
HWND hWnd;
UINT uID;
UINT uFlags;
UINT uCallbackMessage;
HICON hIcon;
TCHAR szTip[64];
DWORD dwState;
DWORD dwStateMask;
TCHAR szInfo[256];
union {
UINT uTimeout;
UINT uVersion;
};
TCHAR szInfoTitle[64];
DWORD dwInfoFlags;
GUID guidItem;
} NOTIFYICONDATA, *PNOTIFYICONDATA;
Members

cbSize
Size of this structure, in bytes.
hWnd
Handle to the window that receives notification messages associated with an icon in the taskbar status area. The Shell uses hWnd and uID to identify which icon to operate on when Shell_NotifyIcon is invoked.
uID
Application-defined identifier of the taskbar icon. The Shell uses hWnd and uID to identify which icon to operate on when Shell_NotifyIcon is invoked. You can have multiple icons associated with a single hWnd by assigning each a different uID.
uFlags
Flags that indicate which of the other members contain valid data. This member can be a combination of the following.
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.
uCallbackMessage
Application-defined message identifier. The system uses this identifier to send notifications to the window identified in hWnd. These notifications are sent when a mouse event occurs in the bounding rectangle of the icon, or when the icon is selected or activated with the keyboard. The wParam parameter of the message contains the identifier of the taskbar icon in which the event occurred. The lParam parameter holds the mouse or keyboard message associated with the event. For example, when the pointer moves over a taskbar icon, lParam is set to WM_MOUSEMOVE. See the Taskbar guide chapter for further discussion.
hIcon
Handle to the icon to be added, modified, or deleted. To avoid icon distortion, be aware that notification area icons have different levels of support under different versions of Microsoft Windows. Windows 95, Windows 98, and Microsoft Windows NT 4.0 support icons of up to 4 bits per pixel (BPP). Windows Millennium Edition (Windows Me) and Windows 2000 support icons of a color depth up to the current display mode. Windows XP supports icons of up to 32 BPP.
szTip
Pointer to a null-terminated string with the text for a standard ToolTip. It can have a maximum of 64 characters including the terminating NULL.

For Version 5.0 and later, szTip can have a maximum of 128 characters, including the terminating NULL.

dwState
Version 5.0. State of the icon. There are two flags that can be set independently.
NIS_HIDDEN
The icon is hidden.
NIS_SHAREDICON
The icon is shared.
dwStateMask
Version 5.0. A value that specifies which bits of the state member are retrieved or modified. For example, setting this member to NIS_HIDDEN causes only the item's hidden state to be retrieved.
szInfo
Version 5.0. Pointer to a null-terminated string with the text for a balloon ToolTip. It can have a maximum of 255 characters. To remove the ToolTip, set the NIF_INFO flag in uFlags and set szInfo to an empty string.
uTimeout
Union with uVersion. The timeout value, in milliseconds, for a balloon ToolTip. The system enforces minimum and maximum timeout values. uTimeout values that are too large are set to the maximum value and values that are too small default to the minimum value. The system minimum and maximum timeout values are currently set at 10 seconds and 30 seconds, respectively. See the remarks for further discussion of uTimeout.
uVersion
Version 5.0. Union with uTimeout. Specifies whether the Shell notify icon interface should use Windows 95 or Windows 2000 behavior. For more information on the differences in these two behaviors, see Shell_NotifyIcon. This member is only employed when using Shell_NotifyIcon to send a NIM_SETVERSION message.
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.
szInfoTitle
Version 5.0. Pointer to a null-terminated string containing a title for a balloon ToolTip. This title appears in boldface above the text. It can have a maximum of 63 characters.
dwInfoFlags
Version 5.0. Flags that can be set to add an icon to a balloon ToolTip. It is placed to the left of the title. If the szInfoTitle member is zero-length, the icon is not shown.
NIIF_ERROR
An error icon.
NIIF_INFO
An information icon.
NIIF_NONE
No icon.
NIIF_USER
Windows XP Service Pack 2 (SP2) and later. Use the icon identified in hIcon as the notification balloon's title 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.
guidItem
Version 6.0. Reserved.
Remarks

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 Using ToolTip Controls chapter.

No more than one balloon ToolTip at at 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. If the user does not appear to be using the computer, the system does not count this time towards the timeout.

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.

You 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 later, 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 will allow your application to use NOTIFYICONDATA with earlier Shell32.dll versions, although without the version 6.0 enhancements.

Structure Information

Header shellapi.h
Minimum operating systems Windows NT 4.0, Windows 95
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
曾,都,结,切,奔,厦的多音字组词
微波的近义词
什么道教公众号比较好
高中生文化成绩不好而且没读艺体可以按照艺体
常依桐名字怎么样
请问大家非教龄工龄是什么意思?
银监会贵州监管局清镇办事处怎么去啊,有知道
金宏信办公用品店在什么地方啊,我要过去处理
CADtools 7 CS5怎么把单位转换成毫米,我倒个
惠普dv6-1123TX怎么样?
安徽是个省还是市?
画眉有必要一天洗两次澡吗?
西安泰达低温设备公司地址在哪,我要去那里办
100%pure&natural是什么意思
赞美葫芦的句子有哪些?
推荐资讯
老毛桃运行2003pe时蓝屏
陈村街道怎么去啊,有知道地址的么
翡翠的硬度有多大?
vivox6plus手机上方显示电池充电
上行文和下行文的三种行式
前脚掌疼如何解决?
一品人家南门地址有知道的么?有点事想过去
沐晴水果店地址在什么地方,想过去办事
扬州苏北人民医院几点关门
领动和名爵6哪个油耗高
大家知道百燕王运动鞋吗?
大家觉得牛仔裤好看还是休闲裤好看?
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?