Today, Delphi is one of the popular desktop programming tool. There are thousand even million programmer in this world using delphi as their favorit tool. This site try to collect the examples, tips and tricks of Delphi programming. We collect, test them and redistribute the collection of delphi programming for you.

Splash Screen When Application Initialized

Author: admin | Category: Form, Tips and Tricks

//This is how we can make splash screen when our application initialized
//From Delphi IDE make new application File | New | Application
//Change Form1 Name property with Main_form
//To make a splash form we need to make a new form, Get a new from with menu File | New | Form
//Change Form2 Name property with Splash_Form
//Now place a Timer (TTimer from System tabs on Delphi IDE) to your Splash_Form ()
//Leave Unit1.pas
//Set the Timer1 OnTimer event like this
 
unit Unit2;
 
interface
 
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls;
 
type
  TSplash_Form = class(TForm)
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Splash_Form: TSplash_Form;
 
implementation
 
{$R *.DFM}
 
procedure TSplash_Form.Timer1Timer(Sender: TObject);
begin
   Timer1.Enabled := False;
end;
 
end.
 
//Then Modify project1.dpr like this:
 
program Project1;
 
uses
  Forms,
  Unit1 in 'Unit1.pas' {Main_Form},
  Unit2 in 'Unit2.pas' {Splash_Form};
 
{$R *.RES}
 
begin
     Splash_Form := TSplash_Form.Create(Application);
     Splash_Form.Show;
     Splash_Form.Update;
 
     while Splash_Form.Timer1.Enabled do
           Application.ProcessMessages;
 
     Application.Initialize;
     Application.CreateForm(TMain_Form, Main_Form);
 
     Splash_Form.Hide;
     Splash_Form.Free;
 
     Application.Run;
end.
 

Tags: ,