[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Showing a window while starting

Posted on 2004-12-01
3
Medium Priority
?
182 Views
Last Modified: 2010-04-05
Hello,

When I run my application, its main form appears on display with a significant delay. How can I provide that a special small window is shown until the main one becomes visible?

Vadim Smolensky,
Saint-Petersburg, Russia
0
Comment
Question by:VSmolensky
  • 2
3 Comments
 
LVL 14

Assisted Solution

by:DragonSlayer
DragonSlayer earned 400 total points
ID: 12714578
You should be able to do something like this in the unit of your main form.

var
  SplashScreen: TSplashForm; // this is the special small window you want to display

procedure TForm1.Form1Create(Sender: TObject);
begin
  SplashScreen := TSplashForm.Create(Self);
  SplashScreen.Show;
  SplashScreen.Update;
end;

and when your form is finally showing:

procedure TForm1.Form1Show(Sender: TObject);
begin
  if Assigned(SplashScreen) then
    SplashScreen.Free;
end;
0
 
LVL 14

Assisted Solution

by:DragonSlayer
DragonSlayer earned 400 total points
ID: 12714582
alternatively, add it in your project source instead:

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Splash in 'Splash.pas' {SplashScreen};

{$R *.RES}

begin
  try
    SplashScreen := TSplashScreen.Create(Application);
    SplashScreen.Show;
    SplashScreen.Update;
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    SplashScreen.Close;
  finally
    SplashScreen.Free;
  end;
  Application.Run;
end.
0
 
LVL 17

Accepted Solution

by:
geobul earned 100 total points
ID: 12714669
My version (almost the same though):

begin
  SplashScreen := TSplashScreen.Create(nil);
  try
    SplashScreen.Show;
    SplashScreen.Update;
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    // other forms and datamodules here
    Application.ProcessMessages;
  finally
    SplashScreen.Release;
  end;
  Application.Run;
end.

Regards, Geo
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 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