Andrew, nah, not an overkill.  My standard form has that built it and 
I call the event "Created".  It is very useful for a whole stack of 
things.  :-)

On 11 Jun 99 at 9:15, Cooke, Andrew wrote:

> I suggest that you use frmSplash.Release instead of Free. You can still set
> frmSplash := nil immediately afterwards, as this is just a pointer to the
> form object.
> What I do is define a custom message and post that to myself when the main
> form is about to be displayed (FormShow). When I receive that message, the
> main form should be visible, so I can get rid of the splash form. May be
> overkill.
> 
> const
>   WM_NOWVISIBLE = WM_USER + 200;
> ...
> type
>  TMyMainForm = class(TForm)
>   private
>     procedure WMNowVisible(var Msg : TMessage); message WM_NOWVISIBLE;
>   ...
>   end
> 
> procedure TMyMainForm.FormShow(Sender: TObject);
> begin
>   ...
>   PostMessage(Handle,WM_NOWVISIBLE,0,0);
> end;
> 
> procedure TMyMainForm.WMNowVisible(var Msg : TMessage);
> begin
>   frmSplash.Close;
>   frmSplash.Release;
>   frmSplash := Nil;
> end;
> 
> I also tried Rohit's comment about inserting an exception. I placed a raise
> Exception.Create('blah') after the Application.CreateForm of the main form,
> but before Application.Run. Sure enough, I got a run-on AV exception. Then I
> removed the splash dialog code and tried again. Still got a run-on AV
> exception. Seems the moral of the story is - make sure you don't get an
> exception there!
> Cheers,
>   Andrew Cooke
> 
> > -----Original Message-----
> > From: Marshall, Paul [SMTP:[EMAIL PROTECTED]]
> > Sent: Friday, June 11, 1999 6:54 AM
> > To:   Multiple recipients of list delphi
> > Subject:  RE: [DUG]:  Welcome image
> > 
> > In my application, the main form's OnShow method looks like this:
> > 
> > procedure TfrmMain.FormShow(Sender: TObject);
> > begin
> >   try
> > 
> >     [...form initialisation code here...]
> > 
> >   finally
> >     frmSplash.Close;
> >     frmSplash.Free;
> >     frmSplash := nil;
> >   end;
> > end; { FormShow }
> > 
> > (but take note of Rohit's remark re. the stability of this solution!)
> > 
> > Regards, Paul.
> > 
> > > -----Original Message-----
> > > From:   Juan Manuel Gomez Ramos [SMTP:[EMAIL PROTECTED]]
> > > Sent:   Friday, June 11, 1999 4:40 AM
> > > To: Multiple recipients of list delphi
> > > Subject:    RE: [DUG]:  Welcome image
> > > 
> > >   Paul:
> > > 
> > >   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.
> > > 
> > >   Juan Manuel Gomez Ramos
> > >   Computer Science student at Havana University
> > >   email:<[EMAIL PROTECTED]>
> > >         <[EMAIL PROTECTED]>
> > >   eFax:(707) 313-0329
> > >   internet:http://cronos.freeservers.com
> > > 
> > >   Hope is faith holding out its hand in the dark.
> > > 
> > > On Thu, 10 Jun 1999, Marshall, Paul wrote:
> > > 
> > > > If you edit the project's DPR file thus, frmSplash will appear while
> > the
> > > > application is creating the other forms. You will need to Close and
> > Free
> > > > frmSplash (and set it to nil) at the end of your main form's FormShow
> > > > method.
> > > > 
> > > >   Application.Initialize;
> > > >   frmSplash := TfrmSplash.Create(Application);
> > > >   try
> > > >     frmSplash.Show;
> > > >     frmSplash.Update;
> > > > 
> > > >     Application.CreateForm(...
> > > >     Application.CreateForm(...
> > > >     
> > > >    Application.Run;
> > > >   finally
> > > >     if Assigned(frmSplash)
> > > >       then frmSplash.Free;
> > > >     { frmSplash will normally have been freed already }
> > > >   end;
> > > > 
> > > > 
> > > > > -----Original Message-----
> > > > > From:   Juan Manuel Gomez Ramos [SMTP:[EMAIL PROTECTED]]
> > > > > Sent:   Thursday, June 10, 1999 12:36 AM
> > > > > To: Multiple recipients of list delphi
> > > > > Subject:    [DUG]:  Welcome image
> > > > > 
> > > > >   How does Delphi shows a welcome image/window while openning its
> > main
> > > > > window?
> > > > > 
> > > > >   Juan Manuel Gomez Ramos
> > > > >   Computer Science student at Havana University
> > > > >   email:<[EMAIL PROTECTED]>
> > > > >         <[EMAIL PROTECTED]>
> > > > >   eFax:(707) 313-0329
> > > > >   internet:http://cronos.freeservers.com
> > > > > 
> > > > >   Hope is faith holding out its hand in the dark.
> > > > > 
> > > > >
> > >
> > --------------------------------------------------------------------------
> > > > > -
> > > > >     New Zealand Delphi Users group - Delphi List -
> > > [EMAIL PROTECTED]
> > > > >                   Website: http://www.delphi.org.nz
> > > >
> > >
> > --------------------------------------------------------------------------
> > > -
> > > >     New Zealand Delphi Users group - Delphi List -
> > [EMAIL PROTECTED]
> > > >                   Website: http://www.delphi.org.nz
> > > > 
> > > 
> > >
> > --------------------------------------------------------------------------
> > > -
> > >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > >                   Website: http://www.delphi.org.nz
> > --------------------------------------------------------------------------
> > -
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 
Rohit

======================================================================
CFL - Computer Fanatics Ltd.  21 Barry's Point Road, AKL, New Zealand
PH    (649) 489-2280 
FX    (649) 489-2290
email [EMAIL PROTECTED]  or  [EMAIL PROTECTED]
======================================================================

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to