How to Capture the screen of another application?

J

JB

I'm trying to write an application to read another program, to capture
the screen, read some text and then write it into a database.
The data i need to get will always be at the same point on the
program's window - but i dont have the first idea how to go about
starting it..

First I need to see if the program is running
Then I need to get the screen co-ordinates of the program.
Then read data from the window, both text from a text-box of sorts, as
well as some images..

Can anyone point me in the direction of how to get started, if it is
even possible?

I did used to use a macro recorder which did a similar task, but it
was never very customizable and often quite unreliable. I had to set
it to alt+tab out of the window, then copy and paste into another
form, and etc.
This had the problem, for example if the form hung the macro wouldnt
realize it and would try to carry on...

Cheers all
 
I

Ignacio Machin ( .NET/ C# MVP )

I'm trying to write an application to read another program, to capture
the screen, read some text and then write it into a database.
The data i need to get will always be at the same point on the
program's window - but i dont have the first idea how to go about
starting it..

First I need to see if the program is running
Then I need to get the screen co-ordinates of the program.
Then read data from the window, both text from a text-box of sorts, as
well as some images..

Can anyone point me in the direction of how to get started, if it is
even possible?

I did used to use a macro recorder which did a similar task, but it
was never very customizable and often quite unreliable. I had to set
it to alt+tab out of the window, then copy and paste into another
form, and etc.
This had the problem, for example if the form hung the macro wouldnt
realize it and would try to carry on...

Cheers all

Hi,

I do not know of any managed way of doing this (I could even say there
is none) even if both apps are managed.
Maybe you can capture part of the window as an image, then you would
need an OCR to convert it to text.
 
D

DSK Chakravarthy

JB,

infact, you can use the process to identify that any of your required
process is running or not ..

Secondly when you activate the window, you dont have to go the co-ordinates
of the program .. because the hWind has the activity set to that process.

For the final concept of reading the window.. blah .. blah .. request you to
explain more in detail to understand your requirement better

HTH
 
J

JB

JB,

infact, you can use the process to identify that any of your required
process is running or not ..

Secondly when you activate the window, you dont have to go the co-ordinates
of the program .. because the hWind has the activity set to that process.

For the final concept of reading the window.. blah .. blah .. request you to
explain more in detail to understand your requirement better

HTH

Thanks for the reply.
So the first part is looking easy enough. As for the next part:

Well I have a winform which has a few text boxes and 1 image.
The text boxes, well i suppose they are pretty standard. The font and
size will always be the same if that would be an issue.
The boxes will always be at the same position on the window, and the
window always the same size.
I just need to be able to read the text from these text boxes, then
process and import into my database.

As for the image, well each 'page' on the form will have a status, and
for some very peculiar reason it is displayed as an image.
It will either be a green tick, red cross or orange/yellow question
mark.
Image always the same size etc.

So would it be possible?

It seems feasible in theory - get a handle to the text box control and
read from it, but i cant see it being that simple....
 

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