I would like to get the tooltip text for win32 legacy control (not WPF controls that inherently support UI Automation).

What I have done:
- Given a button of interest, I've got its
AutomationElement, and its bounding rect - I moved the mouse over this button (in code);
Thread.Sleep(1500)to wait for the tooltip control to popup;- Enumerate Desktop's all child windows, and get the child window
tooltipAutomationElement, whose type is"Tooltip"; - From
tooltipAutomationElement, get this tooltip's name property, which corresponds to the tooltip string.
This actually works, but the penalty is: I have to sleep(1500) and manually wait for the tooltip to appear (5-20 buttons are to be scanned for the tooltip strings), which does not match performance requirement.
What is expected (not sure if it is feasible)
- Programmatically get the button's tooltip string without requiring the tooltip to appear
- Without having to place mouse over each button one-by-one.
Update 1: For TTN_NEEDTEXT, MSDN doc seems not very clear, and I have no clue how to program this using C#. One of the relevant link for low level structures/messages related to tooltip control can be found here.
Update 2: Those who believe this could be done by ... , I would say, it is easier said than done. I welcome those who have tried, to comment on this, and some ostensibly feasible solutions are welcome if you can offer some evidence to show its applicability and effic