I'm hooking ExtTextOut and DrawText. These API's work on a DeviceContext (DC). My question is: For filter purposes, I'd like to know WHICH window (hWnd) is drawing on the DC. I tried using WindowFromDC, but this seems to work solely on what is called a Form in Delphi - it doesn't work on child windows like e.g., a Panel.
Any suggestions would be much appreciated!
ExtTextOut plus DrawText and DeviceContext
It's a good guess! But the window in question is a Delphi TStringGrid component. I checked the source, and it doesn't use any bitmaps. To draw the text in the grid, he calls TextRect of TCanvas, which is implemented as follows:
So I'm still puzzled!
Code: Select all
procedure TCanvas.TextRect(Rect: TRect; X, Y: Integer; const Text: string);
var
Options: Longint;
begin
Changing;
RequiredState([csHandleValid, csFontValid, csBrushValid]);
Options := ETO_CLIPPED or FTextFlags;
if Brush.Style <> bsClear then
Options := Options or ETO_OPAQUE;
if ((FTextFlags and ETO_RTLREADING) <> 0) and
(CanvasOrientation = coRightToLeft) then Inc(X, TextWidth(Text) + 1);
Windows.ExtTextOut(FHandle, X, Y, Options, @Rect, PChar(Text),
Length(Text), nil);
Changed;
end;