PDA

View Full Version : Unable to fill text box of a #32770 window [EXCEL-VBA]



erke
08-31-2016, 06:47 AM
Im trying to automate a windows api by using an excel-vba macro.


When I open a #32770 window, Im able to obtain the textbox handle by doing this:




Do
DoEvents
Loop Until FindWindow("#32770", "Abrir") > 0
hd1 = FindWindow("#32770", "Abrir") 'La ventana resultante de abrir Open
Do
DoEvents
Loop Until FindWindowEx(hd1, 0&, "ComboBoxEx32", vbNullString) > 0
hd2 = FindWindowEx(hd1, 0&, "ComboBoxEx32", vbNullString) 'Cuadro de texto
Do
DoEvents
Loop Until FindWindowEx(hd2, 0&, "ComboBox", vbNullString) > 0
hd3 = FindWindowEx(hd2, 0&, "ComboBox", vbNullString) 'Cuadro de texto interno
Do
DoEvents
Loop Until FindWindowEx(hd3, 0&, "Edit", vbNullString) > 0
hd4 = FindWindowEx(hd3, 0&, "Edit", vbNullString) 'Edición de cuadro de texto
'Without doing <Do> + <DoEvents> + <Loop Until> the handles return 0 (?)



Look a pciture of my scene:


16981


Until here, everything is right. Even Im able to click any button of the 32770 with BM_CLICK. The problem comes when Im triying to send a string text to the "Edit" text box. I try all the posibilities:




'Option 1: Call SendMessageByString(hd4, WM_SETTEXT, 0&, "TEST")
'Option 2: SendMessageByString hd4, WM_SETTEXT, 0&, "TEST"
'Option 3: Call SendMessage(hd4, WM_SETTEXT, 0&, "TEST")
'Option 4: SendMessage hd4, WM_SETTEXT, 0&, "TEST
' I try with PostMessage to



I dont know what the problem is. Any ideas?


Thanks.

Aflatoon
08-31-2016, 08:31 AM
Cross-post: http://stackoverflow.com/questions/39250928/unable-to-fill-text-box-of-a-32770-window