Jump to content

getting tooltip text for an icon button of another program


Recommended Posts

I'm working on a testing program for another program (the target), and I want to

recognize some special buttons.  For buttons with text, I can read the text, but if

there is an icon on the button instead I just get a emtpy string.

The target program wiill display a tooltip with text for the button if a human

makes the mouse hover over it, and while a tooltip is visible I can read the

the tip text with WinGetText (or _GUIToolTip_HitTest).  Unfortunately, the

fact that a tooltip is on the screen does not really tell me it is the tooltip

for that button, and usually, there is not a tooltip being displayed.

Is there some way to get the text for a tooltip associate with a specific button?

Can I send some message to the button control to make its corresponding tooltip

appear so I can read the text withWinGetText.

I've Googled around but I only seem to find info on how to build/display tooltips

from an Autoit program, not how to work with tooltips of a target program.

Link to comment
Share on other sites

I'd be really suprised if _GUIToolTip_HitTest returned anything for a button's tooltip, as it works with tooltips that have $TTF_TRACK set, and static controls rarely will have that set.

You might want to look at _GUIToolTip_GetText and the second example in the help file as a way of getting the text you need.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You are right.  about  _GUIToolTip_HitTest,

I meant _GuiToolTip_GetCurrentTool.

The problem with _GUIToolTip_GetText is that it requires 3 arguments.

I don't know the last two, and have have several tooltips to guess about for the

first one.

This is the information I get about the tooltip when it is visible.

000201be ''
  State(07): Exists, Visible, Enabled
  Style=94000003 Xstyle=00080080
  Class=WindowsForms10.tooltips_class32.app.0.3598b65_r9_ad1
  text: 'Refresh the view with current information.'
   0 0x1e0
   1 0
   2 0x2a
   3 0
   4 0
   5 0
   6 0
   7 0
   8 Refresh the view with current information
   9 0

The "Text::"  line is the string from "WinGetText", and what follows is the array data from

_GuiToolTip_GetCurrentTool.

I'm looking for some way to get from the handle of the button, to the text of the tooltip.

Aside:  Note that the flags happen to include TTF_TRACK.  However, I don't know what.

the 0x40 flag means.

Link to comment
Share on other sites

The second example in _GUIToolTip_GetText doesn't actually use _GetText, it uses _GUIToolTip_GetCurrentTool, you'd have to change the class being used in the example in the WinList function. Although I'm not sure if even that would work with that tooltip because it doesn't appear to use the standard Windows API class to create it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...