Home > Back-end >  After the hook lives exttextout function
After the hook lives exttextout function

Time:09-19

I use hook hook ExtTextOut function, and obtain the lpString is also obtained the output string, encounter a problem now, after I replaced the lpString content to ExtTextOut function to output, string display of problems, such as, I seized the string is "test", and then after I replaced with "success" output, the output only succe these characters can be seen, to all sorts of way, also searched online, didn't find the solution, I think if we can get the size of the original output text area, and put it to the drawing should be able to solve this problem, but it is not found can do API function, support a move to obtain each master, thank you very much!
 
The function NewExtTextOutW (theDC: HDC. NXStart nYStart: integer; ToOptions:
Longint; P_rect: PRect;
Str: Pwidechar; Count: Longint; Dx: PInteger) : BOOL; Stdcall;
Type
TExtTextOutW=function (theDC: HDC; NXStart nYStart: integer; ToOptions: Longint;
P_rect: PRect; Str: Pwidechar; Count: Longint; Dx: PInteger) : BOOL; Stdcall;
Var
DwBytes: DWORD;
PoOri poDC, poText poMouse: TPoint;
Size: TSize;
Rec, tmprec: TRect;
Abbreviation: Boolean;
NTextLen, uf: integer;
TMPSTR: string;
Hf: HFONT;
Tm: the TEXTMETRIC;
The begin
Hook [fExtTextOutW]. Restore; {pause intercept API, restore the cut function}
Try
TMPSTR:='success'; {I replace strings that will be all intercepted success}
STR:=pwidechar (TMPSTR);
Count:=length (TMPSTR);
GetTextExtentPointW (theDC, Str, Count, Size); {calculates wide high string}
If toOptions<> ETO_GLYPH_INDEX then
ToOptions:=ETO_OPAQUE and ETO_IGNORELANGUAGE; {at first thought it was on this parameter in cheating, I dead, if this parameter is equal to the ETO_CLIPPED, output text will control in temprec area, will not exceed}
Tmprec:=the Rect (nXStart nYStart, nXStart + size. The Width, nYStart + size. The Height); {calculated output string intercepted area size, in fact, this line can not, I am really helpless to do the test, the width of the area change no matter how much, didn't affect the result of the final output}
The finally
{call cut function}
Result:=TExtTextOutW (Hook) [r]. FExtTextOutW OldFunction) (theDC, nXStart, nYStart toOptions, @ tmprec, Str, Count, nil);
end;
Hook [fExtTextOutW] Change; {to intercept API}
end;

CodePudding user response:

Intercept the screenshot before

Intercept and replacement string content after screenshots

CodePudding user response:

There is a small found that Delphi label not into a static... Did not handle good trouble ah,,,
His top a, continue to wait for superior to!
  • Related