I was asked why Tooltips appear in Task Manager. I happened to be out of the country when the question was asked, so I had to wait til I got back to the office to investigate.
Sure enough, tooltips show up in Task Manager, under the Applications tab.
I narrowed down the reason to be a fix for this bug:
1. Load VFP 8.0
2. Load Narrator
3. Hover mouse above an icon in the ToolBar or any form that has a VFP control on it with a tooltip
Narrator says: 'Tooltip'
for Narrator to act as it does in most Windows applications and to say 'Tootip: ' and then whatever the tooltip reads
To start Narrator: Start->All Programs->Accessories->Accessibility->Narrator.
Sure enough, for VFP8, narrator just says “Tooltip” and doesn’t speak the text of the tooltip.
Text is drawn on the ToolTip window via calls to the DrawText API, which uses the selected font, colors, etc to draw a bit pattern that looks like text to the user. Once it’s drawn, the window just has a pattern of bits that looks like text to the user.
Active Accessibility is used by Narrator (and Magnifier) to read the text of accessible objects. Narrator queries what the window contents are by calling IAccessible::get_accName and VFP routes the request to the Tooltip service routine. One way to fix the bug was to add additional information to the tooltip structure to keep the text of the tooltip around. Then when get_accName is called, the text can be returned.
A simpler fix which didn’t require changing the tooltip structure was to call SetWindowText to set the title of the window to the text of the tooltip. This takes advantage of the memory already allocated for the window structure by Windows. (SetWindowText for a Windows Button is the Caption of the button. For an application such as Excel, Word or VFP, it’s the title shown in the title bar (and Task Manager).)
So I fixed the bug using the simpler SetWindowText solution: Narrator worked as expected.
Apparently, Task Manager’s algorithm for determining whether a window should show up in the Application tab determines that the VFP tooltip window smells like an Application window if it has SetWindowText to some nonempty text.
See also How does Task Manager determine if an Application is Not Responding?
For more about Active Accessibility, see Excel's new gradient Data Bar feature is cool: you can do it too!