Selecting text in another application and importing it into mine

G

Guest

Hi,

How can select a single word of text, in any application, e.g. Windows
Explorer, Internet Explorer etc. , without double clicking it and instead use
a combination of mouse and keyboard, for example Left Control key + Right
Mouse Button, and retrieve that word into my application.
The app Babylon does somthing similar to this, so I guess it's possible to
do it in c# too.
Any ideas?

Thanks,
Ben
 
K

Kerem Gümrükcü

Hi Ben,

There it a straight way in doing this and i can tell you this
because i am writing a application that works similar. Hook
the Window with Windows API where your cursor is over,
hook into the Controls or Applications Message Queue or
hook into its window procedure and watch for messages
like EM_SETSEL, EM_GETSEL,WM_COPY and messages
like that. You can set a systemwide keyboard hook with windows
hooking api like SetWindowsHookEx() and control your applications
behavior e.g. keybord shortcuts to copy the data you want and how
you will select the text in the control,...

You can do it like that or someone has a btter solution for this,...

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
(e-mail address removed)

Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2

Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/
 
N

Nicholas Paldino [.NET/C# MVP]

I think that the point that has to be made here is that there is no one
single interface that allows you to do such a thing. At best, you can
develop a heuristic which guesses how to deal with certain applications.

The accessibility libraries are actually supposed to be pretty good for
accessing disparate applications for this kind of information, so you could
look there.
 
K

Kerem Gümrükcü

Yes, thats why i said "messages like that", since there is no
single interface for such a task. other applications work the
same way, most of them with a heurisitc behaviour or even
work with image recognition. a fellow developer once wrote
such a application, which involved extreme mathematical
calculation. thats why i say that he has become nuts today!

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
(e-mail address removed)

Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2

Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/
 
N

Nicholas Paldino [.NET/C# MVP]

There are also applications like word, which expose an automation
interface as well... Then there are .NET applications which use windows
messages for the UI, and can expose information through remoting, WCF, etc,
etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top