[fpc-devel] Incompatibilities between win32 windows unit and wince windows unit

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Mon Jan 8 13:32:10 CET 2007


Ok, maybe I´m missing something here. Take a look at this code:

procedure TGDICanvas.DoFillTriangle(const P1, P2, P3: TPoint);
var
  pts : array[1..3] of windows.TPoint;
  pt: TPoint;
begin
  pt := Transform(P1);
  pts[1].X := pt.X;   pts[1].Y := pt.Y;
  pt := Transform(P2);
  pts[2].X := pt.X;   pts[2].Y := pt.Y;
  pt := Transform(P3);
  pts[3].X := pt.X;   pts[3].Y := pt.Y;

  NeedBrush;
  Windows.Polygon(Handle, pts[1], 3);
end;

Under Win32 it compiles OK, but cross-compiling for wince I get this:

C:\Programas\fpGUI\trunk\gfx\gdi\GFX_GDI.pas(629,33) Error:
Incompatible type for arg no. 2: Got "POINT", expected "LPPOINT"

On the line that calls Windows.Polygon

But I went to rtl/wince/wininc/redef.inc I the only occurence of
Polygon I find is this one:

function Polygon(DC: HDC; var Points; Count: Integer): BOOL; external
'gdi32' name 'Polygon';

Isn´t that wrong?? I thougth wince didn´t have a gdi32 library, but it
was called something else. Plus, the declaration has a var parameter,
so I shouldn´t need the @

Next, I get even more confused because of this code:

procedure TGDIApplication.Run;
var
  Msg: TMsg;
begin
  DoBreakRun := False;

  while Windows.GetMessage(@Msg, 0, 0, 0) and
   (not (QuitWhenLastWindowCloses and (Forms.Count = 0))) and
   (DoBreakRun = False) do
  begin
    Windows.TranslateMessage(@msg);
    Windows.DispatchMessage(@msg);
  end;

  DoBreakRun := False;
end;

It compiles and works on both win32 and wince, but Windows.GetMessage
is declared like this:

function GetMessage(var lpMsg: TMsg; hWnd: HWND; wMsgFilterMin,
wMsgFilterMax: UINT): BOOL;external 'user32' name 'GetMessageA';

Do I have a wrong idea of the sintax of var parameters??? I never knew
it would accept both with @ and without and produce the same code...

by the way, I am using mode delphi
-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list