Re: Find textbox in window
Ok I made it work. This is the code that loops for 3 textboxes and fills them with text:
VB Code:
'temp is the handle for the parent window
Do While nbr <= 2
lhWndChild = FindWindowEx(temp, lhWndChild, "Edit", vbNullString)
If lhWndChild Then
nbr = nbr + 1
If nbr = 1 Then
iii = SendMessage(lhWndChild, WM_SETTEXT, 0, ByVal "Text1")
ElseIf nbr = 2 Then
iii = SendMessage(lhWndChild, WM_SETTEXT, 0, ByVal "Text2")
Else
iii = SendMessage(lhWndChild, WM_SETTEXT, 0, ByVal "(""*"")")
End If
End If
Loop
bWnd = FindWindowEx(temp, ByVal 0&, "BUTTON", ByVal "Apply")
iii = SendMessage(bWnd, BM_CLICK, 0, ByVal "0")
DoEvents
But now there is a strange thing that happens after the Do-While loop. I manage to find the "Apply" button and click it, but the program gets stuck after that step (that is, after SendMessage(bWnd, BM_CLICK, 0, ByVal "0")
). Do you have any idea of what it might be?
Very grateful for help.
[Edit]: Sorry for the formatting, don't know how to write real code in here :(
Re: Find textbox in window
OK I think I resolved this too :)
I use PostMessage instead of SendMessage, and then it works.
Re: Find textbox in window
Quote:
Originally Posted by Striver
[Edit]: Sorry for the formatting, don't know how to write real code in here :(
Just use the vbcode tags. See my signature for an example. :)