By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Selecting text in another application and importing it into mine

P: n/a
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
Nov 21 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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ü
ke*****@arcor.de

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/
-----------------------
"This reply is provided as is, without warranty express or implied."

Nov 21 '07 #2

P: n/a
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Kerem Gümrükcü" <ka*******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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ü
ke*****@arcor.de

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/
-----------------------
"This reply is provided as is, without warranty express or implied."

Nov 21 '07 #3

P: n/a
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ü
ke*****@arcor.de

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/
-----------------------
"This reply is provided as is, without warranty express or implied."
Nov 21 '07 #4

P: n/a
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.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Kerem Gümrükcü" <ka*******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
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ü
ke*****@arcor.de

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/
-----------------------
"This reply is provided as is, without warranty express or implied."

Nov 21 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.