Solved

Closing a splash screen

Posted on 1998-11-06
4
238 Views
Last Modified: 2010-04-04
I'm wanting to show a splash screen whilst my app starts, but how do I close or destroy it once my main form is active?

I've created the splash by using the Create, Show, Update methods within it's own implementation section.

Thanks in advance
Darren
0
Comment
Question by:elkiors
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 20 total points
ID: 1345941
Hi elkiors,

put code in your application source, like :

{$R *.RES}

var Splashscreen : TSplashScreen;

begin
  SplashScreen := TSplashScreen.Create(Self);
  SplashScreen.Show;
  Application.CreateForm(TAllExamplesForm, AllExamplesForm);
  SplashScreen.Hide;
  SplashScreen.Free;
  Application.Run;
end.

ps. you can use timer to let splashscreen see for a while

Zif.
0
 

Author Comment

by:elkiors
ID: 1345942
Hi Zif,

Thanks alot ... although I did need to change it a bit:


var Splashscreen : TSplashScreen;

begin
  SplashScreen := TSplashScreen.Create(Application); {THIS IS NEW- SELF CREATED AN ERROR}
  SplashScreen.Show;
  SplashScreen.Update; {THIS IS NEW OTHERWISE IT WON'T PAINT}
  Application.CreateForm(TAllExamplesForm, AllExamplesForm);
  SplashScreen.Hide;
  SplashScreen.Free;
  Application.Run;
end.

At least this q didn't run around in circles like the one we just finished on the Update Query stuff

Thanks again

Darren

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1345943
Hi elkiors,

yep, your correct, I made some mistakes in this one, but it's because it's already a long time ago I made a splash-screen and I thought I still knew it from my head .... seems I don't....

Regards, Zif.
0
 

Expert Comment

by:mami
ID: 1345944
I run my splash in the program.dpr

program Pprogran;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  splash in 'splash.pas' {Fsplash},

{$R *.RES}

begin
  Fsplash := TFsplash.Create(Application);
  Fsplash.Show;
  Fsplash.update; {To paint the splash screen}
  Application.CreateForm(TForm1, Form1);
  Fsplash.Close;
  Fsplash.Free;
  Application.Title := 'Title';
  Application.Run;
end.

and in the unit splash I write.....

unit splash;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TFsplash = class(TForm)
    Panel1: TPanel;
    Image1: TImage;
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }

    procedure Delay(Num: longint);

  end;

var
  Fsplash: TFsplash;

implementation

{$R *.DFM}

procedure TFsplash.Delay(Num: longint);
var
   tc :longint;
begin
     tc :=GetTickCount;
     repeat
           Application.ProcessMessages;
     until ((GetTickCount-tc) >= Num);
end;

procedure TFsplash.FormActivate(Sender: TObject);
begin
  Brush.Style := bsClear;
  Delay(5000);
end;

end.

Of this manner I can control the time that want that the splash this active.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now