[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 735
  • Last Modified:

FindWindowEx - Child Windows have the same name

How do you use findwindowex to get the hwnd of child windows with the same class name?

ParentWindow Classname: "Test"
Child Window Classname "Jackson"
Child Window Classname "Jill"
Child Window Classname "Rick"
Child Window Classname "Bob"
Child Window Classname "Rick"

How would I use findwindowex to retrieve the both child window handles with the classname of "Rick"?

I can't use a big complicated enumeration procedure, there must be a way to keep it simple using findwindowex
0
Hepen
Asked:
Hepen
1 Solution
 
ArkCommented:
hRick1=FindWindowEx(hTest,0,"Rick",vbNullString)
hRick2=FindWindowEx(hTest,hRick1,"Rick",vbNullString)

or, you can use a loop:

dim colRicks as new collection

hRick=FindWindowEx(hTest,0,"Rick",vbNullString) 'Find first in Z order
Do while hRick<>0
   colRicks.Add hRick
   hRick=FindWindowEx(hTest,hRick,"Rick",vbNullString) 'Find next in Z order
Loop
0
 
HepenAuthor Commented:
You rock man! Thank you! I can't believe people use the enumeration method to do this.  
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now