SplashScreen With Progressbar (Delphi)

21 08 2009

SplashScreen With Progressbar (Delphi)


Step 1:
*) Open Delphi Application ( I use Delphi 6 )
*) Create Your application (unit1)

Source Code Unit1:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    StaticText1: TStaticText;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
application.Terminate;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
form2.hide;
end;

end.

Step 2:
*) Add new Form in your application. (File ==> New ==> Form.)
*) Add component: 1 progressbar, 2 timer
*) Create a Splash Screen (Unit2)

Source Code Unit2:

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, ComCtrls, StdCtrls, XP_Form;

type
  TForm2 = class(TForm)
    ProgressBar1: TProgressBar;
    Timer1: TTimer;
    Timer2: TTimer;
    StaticText1: TStaticText;
    StaticText2: TStaticText;
    tfXPForm1: TtfXPForm;
    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Timer1Timer(Sender: TObject);
begin
timer1.Enabled:=false;
end;

procedure TForm2.Timer2Timer(Sender: TObject);
begin
progressbar1.Position:=progressbar1.Position+12;
if progressbar1.Position = progressbar1.Max then
timer2.Enabled:=false;
end;

end.

Step 3:
*) project1
Source Code :

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};

{$R *.res}

begin
form2:=TFORM2.Create(application);
form2.Show;
form2.Update;
while form2.Timer1.Enabled do
application.ProcessMessages;

  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
form2.Hide;
form2.Free;
  Application.Run;
end.

Download Application+Full Source Code:

http://www.4shared.com/file/G__kzhUX/Splash.html


Actions

Information

5 responses

1 09 2009
System32

thanks bro, jangan lupa share ilmu nya…
Gw baru belajar delphi juga…Newbie Bgt

15 09 2009
tyo

pokonya ok deh buat ilmunya nee

25 09 2009
heru widakdo

ok, makasih uda mampir mas tyo…

22 06 2010
Sova Zainuddin

mas, file downloadnya kok gak ada??

23 06 2010
heru widakdo

@mas sova :

Ok, thanks koreksinya, maaf atas ketidakaktifan link2 di beberapa artikel di blog ini.

untuk aplikasi + source splash screen dapat anda unduh di link berikut :

http://www.4shared.com/file/G__kzhUX/Splash.html

Thanks,

Widakdo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: