Jump to content

How to specify dynamic classname to get handle

Recommended Posts

Local $currentFocus = ControlGetFocus("Window1")

;This returns TListBox101

Now i want to use this one to get the handle. I am not sure how i should specify here.I tried

ControlGetHandle("Window1","","[CLASSNAME:"+$currentFocus"]").It didnt work.

Sorry I am new to autoit.

Link to post
Share on other sites


If you look carefully in the Help file, you'll see that CLASSNAME is not a valid input for ControlGetHandle() function (and any other funxtion about Windows or Controls).

Try to use CLASSNN or CLASS and INSTANCE inputs:

ControlGetHandle("Window1","","[CLASSNN:" & $currentFocus & "]")

In the second option, you have to split the CLASS and the INSTANCE from the CLASSNN (should be CLASS:TListBox10; INSTANCE:1) :)

Click here to see my signature:




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...