Jump to content
  • Advertisement
Sign in to follow this  
kaliopi

reading text in window

This topic is 4090 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm fairly newbie to Win32. I wonder if the win32 sdk/directx api can read text from a rendered window? I'm assuming by the time the text is rendered on WINMAIN the graphics releases all it's data to the graphics hardware. It seems to me that the only solution? Analyze pixels in the graphics handle - perhaps an api?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
I'm assuming by the time the text is rendered on WINMAIN the graphics releases all it's data to the graphics hardware.

This all depends how the window renders it text.
If it's done using a static control or an edit control then there's a window handle associated with them.
Just send a WM_GETTEXT to that window.

If the window is rendered using the TextOut, DrawText GDI functions, then the text is discarded (from memory) after the call (the calling application might still have the text around but that's usually not very helpful).
In this case you could use window hooks to intercept the calls and get the text from there.

If the window is rendered by other means (drawing to a bitmap using custom code etc), then there's only image analysis left.
This could be very hard, but also not to bad if there's only a few fonts and font sizes used, and that they are known by you.

My 2c

Edit: The process of retrieving text from general images is called OCR (Optical Character Recognition).
Using google I found an open source project doing something like that here.
Discalmer: Haven't tried the library above...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!