Click here to Skip to main content
16,020,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I sort of a GetWindowText if the text was written using CDCs TextOut/DrawText?
Posted
Comments
this_is_my_alias 9-Sep-10 0:06am    
Hi guys, thanks for the info. I actually am not sure if the window really is using CDC to print the texts, just my suspicion. I'm actually working on making a "Find/Search Tool" for this log viewer application: (BareTail.exe). To make it clear, can you help me figure out how the texts are displayed? Here's the link: ( http://www.baremetalsoft.com/baretail/ )...there's a free version. Anyhelp on determining how to retrieve the texts would be gladly appreciated, Thanks.
this_is_my_alias 9-Sep-10 0:27am    
Hmm...asking you to tell me how to retrieve the texts is too much...All I actually need to know is how the texts are printed on the window...thats it. I will be using C++. Thanks...:)

A "text" that is "drawn" is anymore a text, but is a picture.
To come to a solution you have to either:

* Avoid this situation, keeping somewhere the text as it is before it is drawn
* Try to get the text back using some character recognition from the drawn picture.

The last point is not something into the native API (although there are some specific windows text services that can play this game - just search MSDN for those keys or for "OCR") but require more complex code (some library also exist for that) that is is any case not as fast and "efficient" (in term of CPU usage) than keeping the original text.

A better re-design should be considered. Unless you have to guess the text from somebody else window you have no way to work with.
 
Share this answer
 
You cannot get it easily because it is now part of the bitmap. One way would be to use a member variable to keep the text rendered using TextOut. Or use SetWindowText and use GetWindowText to draw the text if it is an owner-draw control.
 
Share this answer
 
Comments
Dalek Dave 8-Sep-10 4:02am    
Good Answer.
Hm... a drawn by user thing is not a "property" of a window normally...

...but you could try to subclass a control by your own one,
which would provide such string property and its access too... :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900