[fpc-devel] Incompatibilities between win32 windows unit andwince windows unit

Yury Sidorov jura at cp-lab.com
Mon Jan 8 14:31:15 CET 2007


Hi,

redef.inc of wince was copied from win32 and almost all redefinition are hidden by {$ifdef win32}
So compiler only see the following declaration of Polygon in coredll.inc:

function Polygon(_para1:HDC; _para2:LPPOINT; _para3:longint):WINBOOL; external KernelDLL name 'Polygon';

The compiler also see the following declaration of GetMessage in coredll.inc:

function GetMessage(lpMsg:LPMSG; hWnd:HWND; wMsgFilterMin:UINT; wMsgFilterMax:UINT):WINBOOL; external KernelDLL name 'GetMessageW';


I made redef.inc wince only in rev. 5845 and made available Polygon and GetMessage functions. Now you can see what definitions are 
active and what are commented out.
So other redefinitions need to be made in the same way.

Yury Sidorov.

----- Original Message ----- 
From: "Felipe Monteiro de Carvalho" <felipemonteiro.carvalho at gmail.com>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Sent: Monday, January 08, 2007 2:32 PM
Subject: Re: [fpc-devel] Incompatibilities between win32 windows unit andwince windows unit


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
_______________________________________________
fpc-devel maillist  -  fpc-devel at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel 



More information about the fpc-devel mailing list