I am trying to read text from a third party's application, of which I do not have the source code.
I am using c++ and I am trying to stick to the windows API.
I am relatively new to windows programming, though I have looked through MSDN and google for a solution but alas...the forums.
I am trying to read text from a child window (which i think is a custom control) of a parent window.
I can get the handles and IDs from the child and parent windows, and I can send/post messages to these as well.
It is my understanding that controls are just special windows.
It is also my understanding that a programmer can make their own controls.
I suspect that the child window with the text that I want to monitor is a custom control.
Therefore, throughout the post I will call this the "custom control".
This custom control has a scroll bar, and about 10 lines of visible text.
When one clicks on the visible text the whole line is highlighted.
A user can also clig and drag to select multiple lines, but cannot do a click/shift+click to select multiple lines.
Typing ctrl-a does not work to select all.
When one right clicks on the screen s/he gets the option to "copy". This works to copy the selected lines of text.
Also, typing ctrl-c copies the text as well.
I tried using the GetWindowText() on the child window but it is empty.
I suspect the custom control is some type of list-view/list-box text-box control and I would like to programmatically grab text from this window/custom control.
However, being that I do not know the interface to this control, how would I go about collecting/copying this text programmatically.
My plan is to attach a hook to trigger the event (as the text in the custom control is updated), but first I need to know how to copy this text.
I tried enumerating the properties of the child window/custom control, but I wouldn't know what to do with the data pointer of the property once/if I got it.
Also, I read that enumerating the properties would only work if they (the third party programmers) had Set/registered the property in the first place.
Is there a way to get the "interface", methods and data members, of a custom control?
First thing I would do is determine whether the control in question is actually a custom control or not. Take a look at Winspector Spy - http://www.windows-spy.com This will enable you to see which windows messages are being received by the control, along with a host of other detailed stuff.
If the control is based on an existing control, then you may be able to send it specific messages to retrieve the data you want. I would love to give you some more information and some
examples but I'm sat in front of an Apple Mac at the moment!