473,399 Members | 4,192 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,399 software developers and data experts.

How to extract text from windows.

Hi, there:

I have seen some program which extracts text from the computer screen.
For example, my English-Chinese dictionary, which extracts a English word
from the buttons and menus on other applications.

How does this kind of trick work? How do I program them? What are the
keyword to search for information on this topic?

Thanks in advance.

Kelvin


Jul 20 '05 #1
2 2559
Kelvin (st*****@nowhere.com) wrote:
: Hi, there:

: I have seen some program which extracts text from the computer screen.
: For example, my English-Chinese dictionary, which extracts a English word
: from the buttons and menus on other applications.

: How does this kind of trick work? How do I program them? What are the
: keyword to search for information on this topic?
Look at the windows api. Functions such as GetWindow(), EnumWindows(),
GetWindowText(), are required.

Given a top level window, recursively scan through the children. (Each
control etc is a window.)

All the data about each window is available by examining the various
properties of each window (which are available using functions such as
GetWindowText()).

For the generic classes provided by the windows api, the data has the
"obvious" meaning, i.e. the text for a button window is the text shown on
the button.

The only problem is when the window uses a custom class to generate the
display. Then you have to know how to interpret the data from that
window. Most custom classes are the tools provided by a particular
development environment, (e.g. MFC) so if you have the same environment
then you can interpret the data by simply passing it to the appropriate
api functions of that environment.

Actually, for some things you may have to use other functions,
GetMenuString() comes to mind, perhaps there are others.
Jul 20 '05 #2
Your basic technique is as follows:
* Run a timer that regularly gets updates about the window that is
below the cursor.
* At each timer interval you will need to use the APIs WindowFromPoint
and ChildWindowFromPoint. These let you know the window handle below
the cursor.
* From the window handle you can use the GetWindowText to retrieve the
text of the button, edit box, static box or whatever similar item you
desire.
* Do a dictionary matching and translation of whatever text you got
above.

Truth is that most of this is easy to do. See
http://cuinl.tripod.com/Tips/wincaption.htm for an example. The
dictionary part may be a bit more difficult depending on whether you
are doing a simply word-for-word match or you are actually
interpreting a phrase from English to Chinese.

Simon Hayden
www.AutoUpdatePlus.com
Get updates to your clients the quick and easy way.


yf***@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote in message news:<40******@news.victoria.tc.ca>...
Kelvin (st*****@nowhere.com) wrote:
: Hi, there:

: I have seen some program which extracts text from the computer screen.
: For example, my English-Chinese dictionary, which extracts a English word
: from the buttons and menus on other applications.

: How does this kind of trick work? How do I program them? What are the
: keyword to search for information on this topic?
Look at the windows api. Functions such as GetWindow(), EnumWindows(),
GetWindowText(), are required.

Given a top level window, recursively scan through the children. (Each
control etc is a window.)

All the data about each window is available by examining the various
properties of each window (which are available using functions such as
GetWindowText()).

For the generic classes provided by the windows api, the data has the
"obvious" meaning, i.e. the text for a button window is the text shown on
the button.

The only problem is when the window uses a custom class to generate the
display. Then you have to know how to interpret the data from that
window. Most custom classes are the tools provided by a particular
development environment, (e.g. MFC) so if you have the same environment
then you can interpret the data by simply passing it to the appropriate
api functions of that environment.

Actually, for some things you may have to use other functions,
GetMenuString() comes to mind, perhaps there are others.

Jul 20 '05 #3

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

Similar topics

4
by: Don Crossman | last post by:
Assume a MYSQL table, foo. One column, bar datetime. Two rows: 2004-01-01 08:00:00 2004-02-01 08:00:00 select * from foo where extract(day from bar)=1; 2 rows in set...
2
by: Steve | last post by:
let's say you have a java app running in a window on your linux box and it has real time changing content as text. how can you extract the text periodically and save it as a TEXT file. this step...
1
by: dangier | last post by:
I have an Access 2003 table with an XML field that is tagged as follows: <Calendar CompactMode="1"><CustomProperties><CustomProperty Name="startdate" Value="3/26/2007"...
5
by: Steve | last post by:
Hi all Does anybody please know a way to extract an Image from a pdf file and save it as a TIFF? I have used a scanner to scan documents which are then placed on a server, but I need to...
1
by: =?Utf-8?B?S3Jpc2huYWthbnRo?= | last post by:
I have got a requirement as follows. I am having a table RCBL_ERROR in a database in DB2. I need to create a batch file, which has to extract the rows from this table and write those extracted...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.