Interection with other applications

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,

I need to get some information displayed by other software, like getting the
text of a notepad window, the displayed page in IE, and so on. How i Am
supposed to do that?
Messaging? Reflection?

Any help will be appreciated.
Thanks in advance,
ltt19
 
Hi,

You can use the FindWindow API call to return a handle to a specific window.
Alternatively, you can use EnumWindows to return all top level windows that
are currently operational (and filter out the ones that you are interested
in).

Once you have a window handle you can use the SendMessage API call with the
WM_GETTEXT message to retrieve information from that window.

Alternatively, you can use the GetWindowText API call to retrieve text from
a window (as before you will first need to determine the window handle for
the window you are interested in).

All of the calls reside in user32.dll so you will have to import them first.

Hope this helps, I could write some sample code for you if you need any
further help.

regards wibberlet
Got an opinion? Join the debate :-) http://wibberlet.blogspot.com

===============================================
=
 
Hi wibberlet

Your answer will be very useful, this is the kind of information I was
looking for.
By the way, while I was waiting for this forum replies, I've played with
Spy++ tool, and I could not grab the text I wanted. The text I'am trying to
get is displayed in a kind of TreeView, and Spy++ recognizes just the
control, but it can't identify any labels inside it. Does that means that I
can't have it? Will your code work anyway?

Thanks again.
Lucas
 
Hi Lucas,

This is a little harder to do since a treeview has an associated hierarchy
of nodes. I believe you can use the SendMessage API call and use
TVM_GETNEXTITEM and other related parameters.

Take a look at this article which should hopefully point you in the right
direction.

regards wibberlet
Development blog at http://wibberlet.blogspot.com
 
Back
Top