[Lazarus] GetTextExtent on Windows

Jürgen Hestermann juergen.hestermann at gmx.de
Mon Sep 14 18:16:19 CEST 2015

Am 2015-09-13 um 22:09 schrieb Marc Weustink:
> On September 12, 2015 2:12:32 PM GMT+02:00, "Jürgen Hestermann" <juergen.hestermann at gmx.de> wrote:
>> I think many of my problems come from using this deprecated API
>> function.
>> Are there any plans to change this?
> If you had a look at the win32 implementation of GetTextExtentPoint then you would have seen that GetTextExtentPoint32 is used internally.
Where do you find this?
I only find the opposite.
When I follow where Canvas.TextWidth comes from
I end up on in this function from "canvas.inc" (line 1763):

function TCanvas.TextExtent(const Text: string): TSize;
Result.cX := 0;
Result.cY := 0;
if Text='' then exit;
RequiredState([csHandleValid, csFontValid]);
GetTextExtentPoint(FHandle, PChar(Text), Length(Text), Result);

Even more, there is a function declaration for "GetTextExtendPoint32"
but it still uses "GetTextExtendPoint" (line 1162 in "intfbasewinapi.inc"):

function TWidgetSet.GetTextExtentPoint32(DC: HDC; Str: PChar; Count: Integer; var Size: TSize): Boolean;
Result := GetTextExtentPoint(DC,Str,Count,Size);

More information about the Lazarus mailing list