Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

text capture

1 view
Skip to first unread message

cppaddict

unread,
Oct 23, 2003, 7:20:52 AM10/23/03
to
Please let me know if there is better newsgroup for this question....

But I am trying to write an Windows App using MFC that can capture text from
other programs' text boxes and dropdowns (the way snagit does).
I know some of the textboxes I would like to capture use the Rich Edit
Control (CRichEdit class, I believe) but that's about all I know.

In SnagIt, you can mouse over various objects in other programs (textboxes,
buttons, dropdowns, etc.) and it will highlight them -- you can then accept
the selection and capture the desired text. So it seems these objects are
accessible just knowing their screen position, and that the text within them
is also accessible. I would love
to know how this done.

Can anyone offer a starting point for learning about this? Articles, books,
your own explanation, I would appreciate anything.

Thanks,
cpp


Scott McPhillips [MVP]

unread,
Oct 23, 2003, 8:58:08 AM10/23/03
to
cppaddict wrote:

The Spy++ tool included with Visual C does the same thing. Source code
for a Spy-like tool is included in the Platform SDK samples.

--
Scott McPhillips [VC++ MVP]

Adam Clauss

unread,
Oct 23, 2003, 12:03:34 PM10/23/03
to
My guess on this would be that it uses a combination of ::WindowFromPoint
(or CWnd::WindowFromPoint) and ::ChildWindowFromPoint
(CWnd::ChildWindowFromPoint) where point is the current location of the
mouse. Then from the handle retrieved call ::GetWindowText
(CWnd::GetWindowText).

HTH

--
Adam Clauss
cab...@tamu.edu
"cppaddict" <cppa...@yahoo.com> wrote in message
news:oQOlb.5786$Me3....@newssvr29.news.prodigy.com...

cppaddict

unread,
Oct 23, 2003, 2:09:45 PM10/23/03
to
>
> The Spy++ tool included with Visual C does the same thing. Source code
> for a Spy-like tool is included in the Platform SDK samples.
>
> --
> Scott McPhillips [VC++ MVP]
>

Scott,

I couldn't find the Spy-like tool you are referring to. Could you send me
the path to it (relative to "Microsoft Visual Studio," or whatever folder it
is in).

Thanks,
cpp


Scott McPhillips [MVP]

unread,
Oct 23, 2003, 6:07:04 PM10/23/03
to
cppaddict wrote:

Search MSDN CD for "Spy: Monitoring Messages with SPY" or download the
samples online from
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/vcsmpspy.asp>

Joseph M. Newcomer

unread,
Oct 26, 2003, 6:50:00 PM10/26/03
to
You can do WindowFromPoint and ChildWindowFromPoint to get a window handle. You can then
use GetWindowClass to retrieve its class string. Then you can send it appropriate
messages. Note that you can't capture information from owner-drawn listboxes in any
obvious way without knowing how the information is stored, so for all practical purposes,
you can forget owner-drawn boxes, except you can capture the string from those that have
LBS_HASSTRINGS style (which strings may or may not have anything to do with what is
actually displayed...)
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

0 new messages