Might as well add my 2c on this subject.
Try this one - A we bit better as the resources associated with the splash form are
released during the execution of the main application. Notes: Should never use .Free
(unless you can guarantee that there are no windows messages in the TForms' message
queue) on a TFORM or any descendant always use RELEASE instead.
The Application.Processmessages causes the splashform/welcome image to be displayed
while your "CreateForms" are processing. Generally nothing should be done before
Application.Initialize, as this will/may call "Initialisation" procedures in some
units, and if your code relies on this (and most codes does make this assumption) it
could have unpredictable results.
begin
Application.Initialize;
try
SplashForm := TSplashForm.Create( nil );
SplashForm.Show;
Application.Processmessages;
Application.CreateForm(TMainForm, MainForm);
finally
SplashForm.Hide;
SplashForm.Release;
end;
Application.Run;
end.
-----Original Message-----
From: Aaron Scott-Boddendijk [SMTP:[EMAIL PROTECTED]]
Sent: Friday, June 11, 1999 9:13 AM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Welcome image
> I tried the code but, where should I free/close the frmSplash form? I
> use this to show the user a "Loading data..." message while the app delays
> opening tables in it's OnCreate event handler.
My Ideal placement is in the DPR file surrounding all initialization code so
that any forms (not just the main form) created do all their processing
during display of the splash form. The splash form is destroyed immediately
following the applications readiness to become interactive.
program BLAH;
uses
Forms,
{...}
Main in 'Main.pas' {FrmMain},
Splash in 'Splash.pas' {FrmSplash};
{$R *.RES}
var
FS :TFrmSplash;
{Not using a global Object instance pointer. The only globals are The mainform
(probably not necessary) and any shared Datamodules. All other Forms are created
on demand and references passed by parameter where necessary.}
begin
FS := TFrmSplash.Create(nil);
try
FS.Show;
{Do lots of setup stuff}
{like creating the connection to the ORACLE database from registry settings}
{Copying a constraints model from the database to the client}
Application.Initialize;
Application.CreateForm(TFrmMain, FrmMain);
Application.Run;
finally
// It is not clear in the help whether this is necessary but it calls Free anyway.
FS.Release;
end;
end.
--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
application/ms-tnef