I am creating an application that can get text from the selected rectangle on any window. So I am doing this by hooking the ExtTextOut(A/W), TextOut(A/W), DrawText(A/W) apis. I am able to retrieve the text from windows but in some special cases I am not able to get the text properly. When I tried to debug it I saw that the HDC parameter of ExtTextOutW can not been used to get the HWND, because when I try to call WindowFromDC(hdc), it returns NULL HWND.
I tried to find out the reason then I found that this HDC is memoryDC so is there any way to get the HWND from that memory DC.
So Please somebody help me to get the actual HWND from the HDC.
3 Replies - 136 Views - Last Post: 07 August 2012 - 03:55 AM
#1
Hooking ExtTextOutW not gives the text with proper information
Posted 07 August 2012 - 02:45 AM
Replies To: Hooking ExtTextOutW not gives the text with proper information
#2
Re: Hooking ExtTextOutW not gives the text with proper information
Posted 07 August 2012 - 03:25 AM
Since they are drawing to memory DC, then that would imply that they are not drawing into the window(s) that you are watching. Therefore it shouldn't matter and you can just ignore those calls.
Also consider that printing will also use a DC that may not be associated with a window. Again this shouldn't matter since you said that you are only concerned about text being rendered into a rectangle of particular window(s).
I'm sorry if I'm thinking bad of you, but this seems like great malware: a screen reader that doesn't send the typical WM_GETTEXT messages to try to capture screen text. I may have a suspicious mind, but it seems to me the only reason why you'd want the window associated with a memory DC is so that you can get the letters and numbers rendered to a CAPTCHA bitmap before transforms are applied to the bitmap to make it less machine readable.
Of course, this can also be used for good to help out the blind and visually impaired by being able to read the screen, but Windows already has an accessibility API and the mere fact that a target rectangle needs to be selected first doesn't really make this ideal for the blind or visually impaired.
So I'm curious: what are you trying to do with the captured text?
Also consider that printing will also use a DC that may not be associated with a window. Again this shouldn't matter since you said that you are only concerned about text being rendered into a rectangle of particular window(s).
I'm sorry if I'm thinking bad of you, but this seems like great malware: a screen reader that doesn't send the typical WM_GETTEXT messages to try to capture screen text. I may have a suspicious mind, but it seems to me the only reason why you'd want the window associated with a memory DC is so that you can get the letters and numbers rendered to a CAPTCHA bitmap before transforms are applied to the bitmap to make it less machine readable.
Of course, this can also be used for good to help out the blind and visually impaired by being able to read the screen, but Windows already has an accessibility API and the mere fact that a target rectangle needs to be selected first doesn't really make this ideal for the blind or visually impaired.
So I'm curious: what are you trying to do with the captured text?
#3
Re: Hooking ExtTextOutW not gives the text with proper information
Posted 07 August 2012 - 03:53 AM
I think you're right to be suspicious
It could be for legitimate reasons
Though its hard to think of one
in this context.
It could be for legitimate reasons
Though its hard to think of one
in this context.
#4
Re: Hooking ExtTextOutW not gives the text with proper information
Posted 07 August 2012 - 03:55 AM
Agreeing with the above, I'm closing this.
Page 1 of 1
|
|

New Topic/Question
This topic is locked



MultiQuote





|