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
Solved

Closing a splash screen

Posted on 1998-11-06
4
242 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 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