这个我只在对话框添加工具栏之后,当鼠标经过后让它有提示信息时用到的。
以下是摘抄:
1 首先要为使用 TTN_NEEDTEXT 通知 的每个控件提供一个字符串。 就是添加String字符串资源
2 添加消息映射 ON_NOTIFY_EX(TTN_NEEDTEXT, 0, &CMyDialog::OnTtnNeedText)
函数原型:afx_msg BOOL OnTtnNeedText(UINT id, NMHDR *pNMHDR, LRESULT *pResult);
id
发送通知控件的标识符。 未使用。 控件 ID 从 NMHDR 结构为例。
为一个比较有用的结构NMTTDISPINFO。。(经强制转换为pNMHDR)。
结果指针可设置的代码,在返回之前。 TTN_NEEDTEXT 处理程序可以忽略 pResult 参数。
Contains information used in handling the TTN_GETDISPINFO notification code. This structure supersedes the TOOLTIPTEXT structure.
Syntax
typedef struct { NMHDR hdr; LPTSTR lpszText; TCHAR szText; HINSTANCE hinst; UINT uFlags; #if (_WIN32_IE >= 0x0300) LPARAM lParam; #endif } NMTTDISPINFO, *LPNMTTDISPINFO;
Members
-
hdr
-
Type: NMHDR
-
NMHDR structure that contains additional information about the notification.
lpszText
-
Type: LPTSTR
-
Pointer to a null-terminated string that will be displayed as the tooltip text. If hinst specifies an instance handle, this member must be the identifier of a string resource.
szText
-
Type: TCHAR
-
Buffer that receives the tooltip text. An application can copy the text to this buffer instead of specifying a string address or string resource. For tooltip text that exceeds 80 TCHARs, see comments in the remarks section of this document.
hinst
-
Type: HINSTANCE
-
Handle to the instance that contains a string resource to be used as the tooltip text. If lpszText is the address of the tooltip text string, this member must be NULL.
uFlags
-
Type: UINT
-
Flags that indicates how to interpret the idFrom member of the included NMHDR structure.
Value Meaning -
TTF_IDISHWND
If this flag is set, idFrom is the tool's handle. Otherwise, it is the tool's identifier.
-
TTF_RTLREADING
Windows can be mirrored to display languages such as Hebrew or Arabic that read right-to-left (RTL). Normally, tooltip text is read in same direction as the text in its parent window. To have a tooltip read in the opposite direction from its parent window, add the TTF_RTLREADING flag to the uFlags member when processing the notification.
-
TTF_DI_SETITEM
Version 4.70. If you add this flag to uFlags while processing the notification, the tooltip control will retain the supplied information and not request it again.
lParam
-
Type: LPARAM