FindWindowEx Help Needed

nomaam

Member
Joined
Jul 4, 2004
Messages
12
Programming Experience
Beginner
Hello:

I am using Vb.NET 2008, working in a windows form.

I am using FindWindow and FindWindowEx to locate handles in order to grab text from controls within another application using WM_GETTEXT.

All is working well, but I am having a problem when there are many controls with no names and the same class names. I am unsure how to grab the handle of any control after the first control. I have tried using EnumChildWindow but it isn't working out. I am sure there is a way to set a "start" point from where you want to start your search of sub handles.

I have included a snapshot of an example using VisualUIAVerify to capture the control information.

http://www.flickr.com/photos/69181263@N08/6284863269/

In the photo you can see all of the sub handles are simply called "pane" and have all the same class names with no captions. Obtaining text from the first child "pane" works fine. But I would like to grab the handle of the fourth "pane" child specifically.

Is there a way you can set which child number you want to grab or start from instead of having to search by class name / caption for all of the handles? There are no captions for any of the handles and the class names are all the same.

Thanks.
 
Not sure if you mean siblings or descendant child windows, anyway there is no collection of sorts that you can index, you must enumerate.
Both GetWindow and FindWindowEx can be used to get siblings, but they are unsafe for enumerating since a window may be destroyed between the calls. FindWindowEx let you specify class name as parameter for search.
EnumChildWindows if safe for enumerating and it gets all descendant child windows, so if only siblings is of interest you have to check GetParent. GetClassName can be used to filter windows by class.
 
Back
Top