Hallo,
wenn ich deine Vorgaben nehme, dann würde ich so vorgehen:
Delphi-Quellcode:
type
TBusyForm = class(TForm)
Button1: TButton;
private
nTicks: Cardinal;
FOnIdle: TIdleEvent;
procedure OnIdle(Sender: TObject; var Done: Boolean);
public
function Execute: Boolean;
end;
var
BusyForm: TBusyForm;
implementation
{$R *.dfm}
function TBusyForm.Execute: Boolean;
begin
nTicks := GetTickCount;
FOnIdle := Application.OnIdle;
Application.OnIdle := OnIdle;
Result := ShowModal = mrOK;
Application.OnIdle := FOnIdle;
end;
procedure TBusyForm.OnIdle(Sender: TObject; var Done: Boolean);
begin
Done := (GetTickCount - nTicks) >= 5000;
if Done then
ModalResult := mrOK;
end;
Freundliche Grüße