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.
I think you will have to follow that
HDCas it is likely that it will beBitBlt(), or similar, to aHDCthat is associated with an actualHWND:HDCsBitBlt(), and others, and check if the the sourceHDCof theBitBlt()is one of the memoryHDCs that has had text written to it. If it is, check if the destinationHDChas aHWNDand if not then it is a memoryHDCwhich must again be followed