[fpc-pascal]Win32 API Call

Matt Emson memsom at interalpha.co.uk
Thu Jun 24 13:20:46 CEST 2004


> Summing it up: you have to use LongBool (or Windows.Bool) when
> translating WinAPI functions that take or return BOOL type. Boolean is
> not correct, even if it sometimes works.

Actually, you're right up to a point. You should return BOOL, but a Boolean
value will auto convert when assigned a BOOL, hence:

function SwitchToThread: BOOL; stdcall;

but

var
  res: Boolean;
begin
  res := SwitchToThread;

  if res then
   ...;
end;





More information about the fpc-pascal mailing list