Sign in to follow this  
Followers 0
joemol

Getting the handle of an application toolbar

3 posts in this topic

#1 ·  Posted (edited)

I am automating a suite of medical imaging software and having trouble automating some of the controls. I have just managed to automate the popup context menus using poorly documented API calls and parameters(MN_GETHMENU; classname=#32768). (It's obvious when you know what to look for but it took me days to find.)

I am having similar problems with automating the toolbars in the suite. In short, I get a valid handle with,

$hHandle = ControlGetHandle($sAppMainWindow,"","THakAdvancedToolbar4")

Where the ClassnameNN comes from the Window Info widget. But this appears to be the handle of the window not the control itself. Things like _GUICtrlToolbar_ButtonCount($hHandle) don't work. For the context menu I had a similar problem and the solution was,

; Get the popup window handle. The class is a windows constant. There is only one so no need to enumerate. (But can if needed!)
    $hWnd = WinGetHandle($sPopupClass)

    ; Get the menu handle. NOT the same as the window. Uses an undocumented Windows message.
    $hMenu = "0x" & Hex(_SendMessage($hWnd, $MN_GETHMENU, 0, 0))

    ; Select the DICOM control
    ControlSend($sPopupClass,"", $hWnd, "{DOWN}{DOWN}{ENTER}")

Question: How does one find the handle of a control in a window in general? In particular how do I get the handle of a toolbar in an application (not created using the AutoIt GUI) so that I can click the buttons?

I can automate using mouse clicks but this is a mission critical application and I would only use that as a last resort.

Thanks you in advance for your help

Edited by joemol

Share this post


Link to post
Share on other sites



You would have to know what API was used to create the toolbar. If it's not the standard Windows APIs, then AutoIt doesn't have any built-in knowledge of it.

How was the app compiled? A quick Googling of 'THakAdvancedToolbar' got zero results.

:blink:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

How was the app compiled? A quick Googling of 'THakAdvancedToolbar' got zero results.

:blink:

This is a high value commercial product and the ins and outs are fairly closely guarded secrets. I have no idea what it was written in or how it was compiled but so far all of the controls appear to have been derived from standard WIN32 classes. Even some fancy edit boxes and treeviews have responded OK.

I was hoping that someone might know some undocumented toolbox tricks which could help me out. Still hoping...

I may try sniffing messages to see how this thing is activated.

Thank you very much for your response.

Share this post


Link to post
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
Sign in to follow this  
Followers 0