Solved

Closing a splash screen

Posted on 1998-11-06
4
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month5 days, 17 hours left to enroll

626 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