From: Cal Who on
A long time ago I wrote a program that copied the screen.
But that produced an image of the screen.

I'm guessing that that is the best one can do but I would like to copy text
on the screen as text (i.e. as a string)

Do you know if that is possible?

Or maybe, you know why that it is not possible - if so, of course, I'd like
to know that.

Thanks


From: j1mb0jay on
Cal Who wrote:
> A long time ago I wrote a program that copied the screen.
> But that produced an image of the screen.
>
> I'm guessing that that is the best one can do but I would like to copy text
> on the screen as text (i.e. as a string)
>
> Do you know if that is possible?
>
> Or maybe, you know why that it is not possible - if so, of course, I'd like
> to know that.
>
> Thanks
>
>

Hi as a thought you could capture the screen shot as an image as you
mentioned that you have done before. You could then pass the image
through an OCR SDK such as http://www.leadtools.com/sdk/ocr/default.htm
to get the characters from the images.

Hope this helps.

j1mb0jay

#################################################
http://www.dotnethelp.co.uk
From: Peter Duniho on
Cal Who wrote:
> A long time ago I wrote a program that copied the screen.
> But that produced an image of the screen.
>
> I'm guessing that that is the best one can do but I would like to copy text
> on the screen as text (i.e. as a string)
>
> Do you know if that is possible?

Anything's possible. :)

After you capture the image, you can use OCR techniques to convert to
text. Depending on the target you are actually trying to capture, it's
even possible you could hack your way into the process and retrieve the
text data straight from the window or underlying data structures.

The former isn't really even that much of a hack, depending on how much
you know about the window hierarchy of the process, the specific OS
version (Vista and Windows 7 have stronger cross-process security), and
the data you're trying to get, because many windows will just give up
their text contents when sent a simple window message (e.g. WM_GETTEXT,
LB_GETTEXT, EM_GETTEXTEX, etc.)

I guess the real question is, why are you trying to do this? One
obvious application would be some sort of accessibility assistant. But
there are already third-party applications out there to do that.

Actually, speaking of that, Windows does have some kind of accessibility
hooks that programs like that use. I don't know anything about the
specifics, but it's possible you could make progress toward your goal
using those.

Pete
From: Cal Who on


j1mb0jay wrote:
> Cal Who wrote:
>> A long time ago I wrote a program that copied the screen.
>> But that produced an image of the screen.
>>
>> I'm guessing that that is the best one can do but I would like to
>> copy text on the screen as text (i.e. as a string)
>>
>> Do you know if that is possible?
>>
>> Or maybe, you know why that it is not possible - if so, of course,
>> I'd like to know that.
>>
>> Thanks
>>
>>
>
> Hi as a thought you could capture the screen shot as an image as you
> mentioned that you have done before. You could then pass the image
> through an OCR SDK such as
> http://www.leadtools.com/sdk/ocr/default.htm to get the characters
> from the images.
> Hope this helps.
>
> j1mb0jay
>
> #################################################
> http://www.dotnethelp.co.uk

Actually I tried OCR before I posted but the screen resolution is so that
the image was not good enough.
After your post I changed the screen to 800x600 and tried again.
Used Photoshop to resample to 300 and then the OCR worked great.

Thaks


From: Cal Who on


Peter Duniho wrote:
> Cal Who wrote:
>> A long time ago I wrote a program that copied the screen.
>> But that produced an image of the screen.
>>
>> I'm guessing that that is the best one can do but I would like to
>> copy text on the screen as text (i.e. as a string)
>>
>> Do you know if that is possible?
>
> Anything's possible. :)
>
> After you capture the image, you can use OCR techniques to convert to
> text. Depending on the target you are actually trying to capture,
> it's even possible you could hack your way into the process and
> retrieve the text data straight from the window or underlying data
> structures.
> The former isn't really even that much of a hack, depending on how
> much you know about the window hierarchy of the process, the specific
> OS version (Vista and Windows 7 have stronger cross-process
> security), and the data you're trying to get, because many windows
> will just give up their text contents when sent a simple window
> message (e.g. WM_GETTEXT, LB_GETTEXT, EM_GETTEXTEX, etc.)
>
> I guess the real question is, why are you trying to do this? One
> obvious application would be some sort of accessibility assistant. But
> there are already third-party applications out there to do that.
>
> Actually, speaking of that, Windows does have some kind of
> accessibility hooks that programs like that use. I don't know
> anything about the specifics, but it's possible you could make
> progress toward your goal using those.
>
> Pete


I may try that just for fun.
Do you think I should try code like we did before managed code came about (I
still have my Petzold book).
Do people still code the old windows api
If not, can you point me to an example - anything - not necessarily related
to my original post.

What started this is I did a search for files and wanted to send the result
list to someone but folders don't allow you to copy the displayed text.

Thanks