I ran into a similar situation with processing MDI Child windows, which act more like controls than like child windows. In an application I automate all the time, I need to be able to find child windows under a given parent whos classname matches a particular class pattern. I do it with something like this:
Code:
; Find a Clarion MDI Child window whos title matches a specified pattern. Note that this is
; sample code, and omits all error processing, etc.
MainWindowTitle := "Specify the Main Window here as a Regex"
TargetChild := "Specify the child window name as a Regex"
SetTitleMatchMode, Regex
ControlGet MdiHandle, hWnd, , MDIClient1, ^
WinGet MsqControls, ControlListHwnd , ahk_id %MdiHandle%
Loop, Parse, MsqControls, `n
{
WinGetClass ChildClass, ahk_id %A_LoopField%
if(!RegexMatch(ChildClass, "^ClaWin"))
Continue
WinGetTitle Title, ahk_id %A_LoopField%
if(RegexMatch(Title, TargetChild))
{
Result := A_LoopField
break
}
}