[fpc-devel] Win32 API call GetSystemInfo in {$Mode Delphi} fails

Graeme Geldenhuys graemeg.lists at gmail.com
Mon Jul 17 10:35:11 CEST 2006


Hi,

The win32 API call, GetStartupInfo() fails under FPC with {$Mode
Delphi} and no preceding @ sign in the parameter.  Under Delphi 7 you
can call GetStartupInfo as show below.


---------- Delphi [System.pas]  ------------------------
procedure GetStartupInfo(var lpStartupInfo: TStartupInfo); stdcall;
  external kernel name 'GetStartupInfoA';

example of usage:
function GetCmdShow: Integer;
var
  SI: TStartupInfo;
begin
  Result := 10;
  GetStartupInfo(SI);
  if SI.dwFlags and 1 <> 0 then
    Result := SI.wShowWindow;
end;
----------------------------------------


----------- FPC [ascfun.inc]  --------------------------
procedure GetStartupInfo(lpStartupInfo:LPSTARTUPINFO); external
'kernel32' name 'GetStartupInfoW';


Under FPC it must be called as follows, it DELPHI mode or ObjFPC mode.
[ ... ]
  GetStartupInfo(@startupinfo);
[ ... ]

----------------------------------------------------


Under FPC the GetStartupInfo parameter is defined differently to
Delphi.  Is this a bug in FPC?

Regards,
  Graeme.

-- 
There's no place like 127.0.0.1



More information about the fpc-devel mailing list