在对窗口上的一个控件进行说明时,我使用了ToolTip控件(自建的),可是当鼠标移走时,ToolTip显示的内容却没有消失,我不知道怎样做到,有没有高手帮忙!下面是我自建的代码:
hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS,
NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
hwnd,
NULL,
hInst,
NULL
); SetWindowPos(hwndTT,
HWND_TOPMOST,
0,
0,
0,
0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); /* GET COORDINATES OF THE MAIN CLIENT AREA */
GetClientRect (hwnd, &rect);
/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hwnd;
ti.hinst = hInst;
ti.uId = uid;
ti.lpszText = lptstr;
// Tooltip control will cover the whole window
ti.rect.left = rect.left;
ti.rect.top = rect.top;
ti.rect.right = rect.right;
ti.rect.bottom = rect.bottom;
SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
我想请问,怎样设置ToolTip显示的时间??
有分相送!!有例子的朋友更好,Email: [email protected],谢谢!
hwndTT = CreateWindowEx(WS_EX_TOPMOST,
TOOLTIPS_CLASS,
NULL,
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
hwnd,
NULL,
hInst,
NULL
); SetWindowPos(hwndTT,
HWND_TOPMOST,
0,
0,
0,
0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); /* GET COORDINATES OF THE MAIN CLIENT AREA */
GetClientRect (hwnd, &rect);
/* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hwnd;
ti.hinst = hInst;
ti.uId = uid;
ti.lpszText = lptstr;
// Tooltip control will cover the whole window
ti.rect.left = rect.left;
ti.rect.top = rect.top;
ti.rect.right = rect.right;
ti.rect.bottom = rect.bottom;
SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
我想请问,怎样设置ToolTip显示的时间??
有分相送!!有例子的朋友更好,Email: [email protected],谢谢!
{
if (uMsg >= 0x0200 && uMsg < 0x0210)
SendMessage(hwndTT, TTM_RELAYEVENT, 0, (LPARAM)pMsg); TranslateMessage(pMsg);
DispatchMessage(pMsg);
}