Внутри файла проекта:
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
uSplashScreen in 'uSplashScreen.pas' {frmSplashScreen};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
frmSplashScreen := TfrmSplashScreen.Create(nil);
try
frmSplashScreen.Show;
// Create your application forms here
Application.CreateForm(TForm1, Form1);
while not frmSplashScreen.Completed do
Application.ProcessMessages;
frmSplashScreen.Hide;
finally
frmSplashScreen.Free;
end;
Application.Run;
end.
Внутренний блок заставки:
unit uSplashScreen;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TfrmSplashScreen = class(TForm)
Timer1: TTimer;
procedure FormShow(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
Completed: Boolean;
end;
var
frmSplashScreen: TfrmSplashScreen;
implementation
{$R *.dfm}
procedure TfrmSplashScreen.FormShow(Sender: TObject);
begin
OnShow := nil;
Completed := False;
Timer1.Interval := 3000; // 3s minimum time to show splash screen
Timer1.Enabled := True;
end;
procedure TfrmSplashScreen.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
Completed := True;
end;
end.
Заставка будет видна минимум 3 секунды и более, если создание всех форм вашего приложения займет больше времени.