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

Which API And How control...Thanks.

5 views
Skip to first unread message

Oscar

unread,
Aug 18, 2004, 10:20:46 PM8/18/04
to
Hi,
Who known which api can 'control out of current program'?
That Mean:
I try to key in some text document on the 'microsoft notepad'.
such as 'Microsoft'.
then i use 'mouse point' OR 'highlight Select'the current word,
my delphi program show me something.( Such as: POP up the windows
, 'Is A Software Companny'.

I used delphi 5, any ideal todo this?
thanks.

Peter Below (TeamB)

unread,
Aug 19, 2004, 5:36:24 AM8/19/04
to

Windows is designed to run programs (=processes) isolated from each
other. Every process has its own independend memory address space, for
example, so a pointer to a memory location in one program is not valid
in another program (Win16 was different in this area). There are a few
defined ways in which programs can communicate with each other, but
that requires that both partners of the communication actively support
this.

The design of Windows makes stuff like your project hard to impossible
to do, especially if you are not familiar with Windows' architecture.
Your short problem description already contains a number of invalid
assumptions, for example. From a users point of view it may look like
text-processing programs are all very similar, you can type text into
them, select text via mouse and keyboard, copy and paste from the
clipboard etc.. From a programs point of view, however, there are many
different implementations of this functionality. Notepad uses a
standard multiline edit control (like a Delphi TMemo) to handle the
text and interaction with the user. Wordpad uses a rich edit control
(TRichedit in Delphi), MS Word and other more complex text processors
use custom windows not based on any of the standard Windows controls.
Generally, you do not know how the program the user is currently
working with implements its text handling. If you do not know that you
cannot determine how you would go about detecting a selected bit of
text in the programs window, or how to get that text, if possible.

If you have all the required information it is usually possible to
write such an add-in tool for a specific program (like Notepad), but
even then it is not easy. The only halfway generic way to do it is to
grab a copy of the screen image of the window as a bitmap and perform
optical character recognition (OCR) on it to extract the text. OCR is a
barrel of worms in itself, especially if you don't know up front which
part of the image contain text and what fonts and language the text is
in....

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be


Oscar

unread,
Aug 20, 2004, 3:04:24 AM8/20/04
to
Thanks
0 new messages