I have a problem, I hope you can help me out. Already out of my research luck... tried stackoverflow, google, even yahoo...
How can I force a tooltip to come out NOT using the mouse?
I am currently implementing some windows automatization and need to force the tooltips to appear.
Like this. Usually you have to hold your mouse over that bar for like 1 - 2 seconds.
I want to force these tooltips to appear using the WINAPI or something similar.
Somethink like "SendMessage/Postmessage(hwnd, "WM_COMEOUTTOOLTIP", 0, lParam (with x and y Position)".
Does something like this exist in WINAPI? Have googled crazy but found nothing.
Thanks guys for your help!
Jonathan
This SO Answer mentions that you can use the TTM_POPUP message to bring up a tooltip, using TTM_TRACKPOSITION to set the position of the tooltip.
EDIT: I got a bit curious about this and tried to make a working sample:
a) include common controls in the manifest or use the following line in the source
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
b) create and set up the tooltip window
hWndtoolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, 0, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT, hWndParent, 0, hInstance, 0);
SetWindowPos(hWndtoolTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
TOOLINFO ti = {};
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = TTF_SUBCLASS;
ti.hwnd = hWndParent;
ti.hinst = hInstance;
ti.uId = (UINT)hWndtoolTip;
ti.lpszText = L"tool-tip";
GetClientRect(hWndParent, &ti.rect);
SendMessage(hWndtoolTip, TTM_ADDTOOL, 0, (LPARAM)&ti);
c) to show the tooltip at a specific postion (say, x=300, y=300):
SetCursorPos(300, 300);
SendMessage(hWndtoolTip, TTM_POPUP, 0, 0);