473,394 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Get highlighted text from any window

How can I get a word from any window and copy it to my application?
Someone have told me I possibly can use EM_GETSEL or the EM_GETSELTEXT
"command" in the WinAPI.
I want to select the word or get the word under the mousepointer (like
Babylon translation). Can anyone give me an example?
Nov 16 '05 #1
1 6498
P?l F,

In order to do that, you would want to call the WindowFromPoint API
function through the P/Invoke layer. This will give you a window handle
under the point. At that point, you can get the text, or the selected text
using the previous methods (calling SendMessage with EM_GETSEL or
EM_GETSELTEXT).

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

"P?l F" <pa***@hotmail.com> wrote in message
news:97**************************@posting.google.c om...
How can I get a word from any window and copy it to my application?
Someone have told me I possibly can use EM_GETSEL or the EM_GETSELTEXT
"command" in the WinAPI.
I want to select the word or get the word under the mousepointer (like
Babylon translation). Can anyone give me an example?

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Doug van Vianen | last post by:
Hi, I am working on an Applet which provides some mouse practice for new computer users in our local seniors' computer club. The applet contains several cards, in a card layout, which are...
1
by: jon | last post by:
I have an Applescript that copies highlighted or selected webpage text. tell application "Internet Explorer" set theWindowInfo to GetWindowInfo (item 1 of (ListWindows)) set theText to selected...
4
by: JE | last post by:
Hi! I am snooping around all sorts of websites and faqs, in search of a way to pick up any selected (mouse-highlighted) text in a HTML page, and store it in a JavaScript variable. I have...
2
by: Julian Jordan | last post by:
Hi I'm trying to write a system in which you can highlight some text in a form box, click a button (or press a key combination) and the text highlighted gets surrounded by a given html tag. ...
1
by: coco | last post by:
Hello everyone I have a question, How can I search a string (called TextBox1.Text) in "e.Item.Cells(0).Text" and if this string exist, then it will be highlighted (yellow), only the string. ...
14
by: Gary Shell | last post by:
I have five comboboxes each has a item listed populated by hand in the IDE. Each has the text property bound to a text field in the database. When I initially fill the dataset and display the page...
3
by: njuneardave | last post by:
Hey, Here is a quick question: I have two forms that I am using, and I need to highlight the text in Form1 by clicking and dragging (obviously). So, when I switch to Form2 (making it the focused...
3
by: Doug | last post by:
Hi I am trying to find a way to make the mouse cursor move to the keyboard cursor position in an application. For example, I use an application called Enterprise Guide, and I control this...
1
by: NvrBst | last post by:
ListView is in Detailed Mode, and an Item is in EditMode (ListViewItem.BeginEdit()), how, if any, would I get the currently highlighted portion of the text? Basically I have a ctrl-c shortcut...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.