[fpc-pascal] simple messagebox for windows

John Lee johnelee0 at gmail.com
Tue Jul 5 18:54:37 CEST 2011


Trying to implement a win messagebox with timeout, I googled & found a
mention of an undocumented messageboxtimeout api & its delphi call.

See noddy program below - works for messagebox() with boolean false,
unfortunately fails with boolean true & gives 'not found in user32' message
in my xp.

Anyone know if there is a messageboxtimeout or similar functionality in win
or a  fpc implementation of this?

John

uses windows;
function MessageBoxtimeout(w1:longint;l1,l2:pointer;w2:longint;l,t:longint)
 :longint; stdcall; external 'user32' name 'MessageBoxtimeoutA';
function MessageBox(w1:longint;l1,l2:pointer;w2:longint)
 :longint; stdcall; external 'user32' name 'MessageBoxA';

var errorbuf:string;
    l,n,t:longint;

begin
 errorbuf:='1234567';
 l:=0;
 t:=1000;
 if false
  then
   n:=MessageBoxtimeout(0, at ErrorBuf[1],pchar('Error'),0,l,t)
  else
   n:=MessageBox(0, at ErrorBuf[1],pchar('Error'),0);
 writeln(n);

end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110705/a3d3806d/attachment.html>


More information about the fpc-pascal mailing list