Ok, based on sergei ideas, here is a improved version:

var
 WideText: WideString;
 AnsiText: AnsiString;
 ...
{$ifdef UnicodeWinInterface}
  WideText := Utf8Decode(ButtonCaption);
  if UnicodeEnabledOS then
    GetTextExtentPoint32W(hdcNewBitmap, PWideChar(WideText),
Length(WideText), TextSize)
  else
  begin
    AnsiText := AnsiString(WideText);
    GetTextExtentPoint32(hdcNewBitmap, LPSTR(AnsiText),
Length(AnsiText), TextSize);
  end;
{$else}
  GetTextExtentPoint32(hdcNewBitmap, LPSTR(ButtonCaption),
Length(ButtonCaption), TextSize);
{$endif}

I tested on win xp with fpGUI and works good. Need to test on win98.

--
Felipe Monteiro de Carvalho

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to