Teen Programmers Unite  
 

 

Return to forum top

Win api Prob in VB

Posted by Evilz [send private reply] at August 22, 2001, 08:18:05 PM

Sup, I'm really new to api so this might sound kinda stupid. I don't know.

Anywho. I'm trying to find the handle of window of class "Edit" Now that seems simple enough but there is two windows of the class "Edit" under the same parent so when I do:

Findwindowex(Parent,Child,"Edit",vbnullstring)

It returns 0 prolly because there is two. Now how am I supposed to work with hWnd 0? Any suggestions?

Posted by taubz [send private reply] at August 22, 2001, 10:42:15 PM

After reading the MSDN page on that API call, if it returns a zero, then there were either no matching windows or there was an eror. If there are two matching windows, the call will return the first of the two.

You can try using GetLastError to see what happened, but that can be a pain.

More likely, you're not calling the function with the correct arguments. For Child you should be specifying 0 for the first time, indicating start searching for a child at the beginning of the window's list of children. If you want to find a second matching window, use the hWnd you got as the return value of the first call as the Child parameter to the next call.

I hope that helps...

- taubz

PS: Always consult the MSDN at http://msdn.microsoft.com/library.

Posted by KillerQ13 [send private reply] at August 31, 2001, 07:47:35 PM

Use nothing (zero) for the first child and then use the return (if it works right) to search for the other one.

Child = FindWindowEx(Parent,0,"Edit",vbNullString)
Child2 = FindWindowEx(Parent,Child,"Edit",vbNullString)

Also, make sure the parent is legit otherwise use nothing for that, too.

KillerQ13

Posted by taubz [send private reply] at August 31, 2001, 10:13:21 PM

Am I always saying nonsense, cause it seems people always follow up my replys with the same thing again?

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.