Re: Getting selected text from last active program

From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 12/11/03


Date: Thu, 11 Dec 2003 17:41:05 GMT

Niklas A wrote:
> In programs like WordFinder you can select a text in any program and
> then just press the shortcut and they will automaticly get the
> selected text and display the translation for you.
> The same thing happens in Google Deskbar. You select a text and you
> press a key kombination and it will automaticly search for that text
> with Google.
>
> But I've been wondering how you do this in a programming language like
> c or c++. I've been thinking about trying to get a handle to the last
> active window and then somehow get the selected text from there.
>
> I've tried to search for information on the Internet but all I get is
> how to select text or get selected text in the same program which is
> not what I want.

In Standard C and C++, your input facilities are text streams and
the parameters passed to the main() function. The output facilities
are text streams and the value returned from the main() function.
Anything else depends on the platform.

Some platforms provide "clipboards" for passing data between
programs. Others use sockets and pipes. Some even have memory
areas reserved for passing data between applications.

You will have to explore the facilities that are available on
your target platform(s).

-- 
Thomas Matthews
C++ newsgroup welcome message:
          http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq:   http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
          http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
     http://www.josuttis.com  -- C++ STL Library book


Relevant Pages

  • Re: Where is the FAQ?
    ... Many thanks to Greg! ... >the final URL for the FAQ will change. ... but without it becoming platform specific. ... >put up some web pages with common platform related problems (getting ...
    (alt.comp.lang.learn.c-cpp)
  • Re: threads without threads
    ... > I have a counter loop which actually executes in a different thread. ... Does ANSI C provide any inherent function ... you _could_ write a wrapper function for your platform ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
    (comp.lang.c)
  • Re: exe to C++ source code
    ... Many compilers, which compile to different ... platform specific instructions. ... C++ Faq: http://www.parashift.com/c++-faq-lite ...
    (comp.lang.cpp)
  • Re: traumatized by pointer casting
    ... > Since this is the platform I am dealing with, ... physical source to as few places as possible. ... Also, dealing with a structure ... C++ Faq: http://www.parashift.com/c++-faq-lite C Faq: http://www.eskimo.com/~scs/c-faq/top.html alt.comp.lang.learn.c-c++ faq: ...
    (comp.lang.c)
  • Re: ostream::write() error result
    ... > badbit (critical error in stream buffer) ... > but I would like to know if there was not enough free disk space to perform ... then use some platform specific functions for determining ... Read the FAQ and Welcome.txt links below. ...
    (comp.lang.cpp)