How to get text from boxes with same hwnd using SendMessage

BrianM

Member
Joined
May 18, 2009
Messages
6
Programming Experience
5-10
Hi everybody,

I am currently writing a program that must extract data from the screen of another application. This application is a client side database interface. When the client retrieves data from the database it is displayed on this form. I am currently using.

Call SendMessageByString(CInt(TextBox1.Text), WM_GETTEXT, length + 1, textRec)
Call SendMessageByString(CInt(TextBox1.Text), WM_GETTEXT, length + 1, textRec)

to extract the data from the client screen.

This works well except for one secion of the screen which seems to contain 26 text boxes. These text boxes all seem to have the same hwnd and the class name is Edit. The funny thing is if I select one of the text boxes by click on it with the mouse I can then retrieve the data from that text box. If I select another text box. I then retrieve the text from that text box and loose the text from the first text box, and while I select the next text box the hwnd for the text box does not change,

It is almost as if this is a group of data and when I try to return the data from this group it is does not know how to do this unless I select one of the text boxes. It is almost as if I need to enum throw the text boxes to get the text.

Does anybody have a posable solution to this?

Thanks
 
It does the same. In the first screen shot I have click on the textbox containing the word "MR"

First.jpg


In the second screen shot I click on the field containing "AT". In both cases the hwnd stay the same and the text reflected is the one that I have selected.

Second.jpg
 
That does seem rather bizarre behaviour. I notice that Spy++ shows other Edit controls. When you switched focus from the one containing MR to the one containing AT, did any of the others show that they contained MR?
 
The Edit fields do not change. But what does happen is if no fields are selected. The 000208B2 edit field disappears. It is almost as if the edit fields are invisible until selected.
 
Back
Top