Jump to content
Sign in to follow this  

Possible to scrape all controls on a form?

Recommended Posts


I'm trying to use autoit to generate a list of all editboxes on a windows form. like a simple vbasic form with 5 edit boxes.

I'd like to scrape the form for all "children" and make a list of the controls. I was trying to use _WinAPI_GetWindow and if I use the $GW_CHILD option, I can get the handle of the first editbox control on that page. But How do I get the rest?

Share this post

Link to post
Share on other sites

Look at _WinAPI_EnumWindows, _WinAPI_EnumWindowsChild - I think it will help you to start.

Also search forum I think this was discussed here already.

Here are some links for you


Func _GetClassName($hWnd)
  Local $ret = DllCall("User32.dll", "int", "GetClassName", "hwnd", $hWnd, "str","", "int", 4096)
  Return $ret[2]
Edited by Zedna

Share this post

Link to post
Share on other sites

That link returns an error

Code from corrupted/deleted post

; get rid of $ctrl & $n from $ctrlIDs and you could StringSplit() IDs into an array.

$ctrlIDs = ""
$buffer = @LF & WinGetClassList("Run")
While StringLen($buffer) > 1
    $ctrl = StringTrimLeft(StringLeft($buffer,StringInStr($buffer,@LF,0,2)-1),1)
    $n = 1
    While StringInStr($buffer,@LF & $ctrl & @LF)
       $hwnd = ControlGetHandle("Run","",$ctrl & $n)
       $ID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $hwnd)
       $ctrlIDs &= $ctrl & $n & "=" & $ID[0] & ","
       $buffer = StringReplace($buffer,@LF & $ctrl & @LF,@LF,1)
$ctrlIDs = StringTrimRight($ctrlIDs,1)

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