Jump to content

How to find a controls HWND

Recommended Posts

I am attemtpting to automate a .NET web Application using normal AutoIT functions and I have been having a lot more success then I thought I would.

My Problem is that I ran into an area where the AutoIT Info tool can't see the Controls, I used Winspector which is able to see many different controls with the same names, only the HWND's are different. I used the ControlClick using the HWND of the item I want to select and it worked. But How can I get the HWND using AutoIT when I can't see the control to use the ControlGetHandle? B)

Below is a picture of what Winspector shows of the area with the controls.

Any help would be Greatly appreciated.


edit: from the image below 0x001B0400 is the HWND I used successfully to select the ComboBox.

Edited by MikeOsdx
Link to post
Share on other sites

OK, Using the WinID I have attached 3 screenshots below.

The first is the info on the ComboBox I want to select.

The Second is of the Same ComboBox after closing and re-launching the .NET application

The Third is of a ComboBox located next to the one I want, This is just to show you that the only apparent differences between the two ComboBoxes are the items that Windows generates when launching the application.


Link to post
Share on other sites

I See, well, before i can help, if you dont mind me asking,

what is your expiriance with the following :


Win API -> GetWindow

Win API -> GetClassName

basiclly, all you need to do is to enumerate the controls that you want,

by their handls and check there class names for -> 'WindowsForms.10.COMBOBOX.app10' .

Link to post
Share on other sites


If I understand your code correctly you are cycling through WindowsForms10.COMBOBOX.app10 and adding 1 to the end of the control name, but my problem is that I have 6 Combo Boxes with the Exact same Control name of WindowsForms10.COMBOBOX.app10 the only way I can tell the difference between them is with the HWND.

Is there a way to loop through all HWND's that match the WindowsForms10.COMBOBOX.app10 controls?, it may take a while but if that's possible I could look inside each combobox looking for specific data in the combobox. once I find the Data I'll know which one is which.

AutoIT Geek,

As for the API and DLL calls, I would be called an amature but I usually catch on quickly.



Link to post
Share on other sites

I am looking at...







... until AutoIt says I get an error


Right, that's what I thought, But my problems is I have the following Combo Boxes on one screen

WindowsForms10.COMBOBOX.app10 with a HWND of 0x00010844

WindowsForms10.COMBOBOX.app10 with a HWND of 0x00030884

WindowsForms10.COMBOBOX.app10 with a HWND of 0x00020880

WindowsForms10.COMBOBOX.app10 with a HWND of 0x0002087A

WindowsForms10.COMBOBOX.app10 with a HWND of 0x00020874

WindowsForms10.COMBOBOX.app10 with a HWND of 0x0002086E

WindowsForms10.COMBOBOX.app10 with a HWND of 0x00020868

the 2nd one in the list above is the one I want but so Far I can only select it using the HWND that I have to manually look up with an External program Winspector, the AutoIT Info tool can't seem to see them.


Link to post
Share on other sites

larry offerd a good option to start with, try it.

this approch will enumerate each control by its instance and since you have only six by specific order

it hard to get lost.

my own advice is more ... win API releated and erquires a bit more programming.

enumerating hwnds in a windows goes by specific order. you can get down to forth level grandchildren.

look at the pointers i gave you and give feedback if you would like more help.

have joy.

Link to post
Share on other sites


I'm Done... I am going to use Mouse clicks.

I got it to work using the .102 as Larry suggested but only the first time. When I closed the app, reopened it and tried it again it didn't work. Turns out that since the combo boxes are inside a WindowsForms10.window.8.app104 and they are not visible until you click on the space they are located in, not even the WinGetClassList shows them until I have clicked on them to show them at least once.

Why do Web Applications always have to be a pain in the Ass...?

So, Thank you all for the effort, but I have so much more do do with this script I am just going to send mouse clicks for now.


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...