Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++

Showing a splash screen at startup

Author: Embarcadero USA

 Question and Answer Database

FAQ533C.txt   Showing a splash screen at startup
Category   :VCL
Platform    :All
Product    :C++Builder  1.x

Question:

Where is the best place to open a splash screen on program
start up?

Answer:

The best place to open a splash screen is in the project
source file after initializing the Application object and
before running the Application object.
This is accomplished by creating a "splash" form on the fly
and then displaying it before the main loop of the app is
entered.  Just before calling Application->Run(), we hide
and delete the splash form.

//---------------------------------------------------------------------------
#include 
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1);
USERES("Project1.res");
//---------------------------------------------------------------------------
// Be sure to include the header for the splash form.
// This splash form is called TSplashForm.
#include "Splash.h"
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
    Application->Initialize();

    SplashForm = new TSplashForm(Application);
    SplashForm->Show();
    SplashForm->Update();

    Application->CreateForm(__classid(TForm1), &Form1);
    
    SplashForm->Hide();
    delete SplashForm;

    Application->Run();

    return 0;
}

7/2/98 10:32:32 AM
 

Article originally contributed by Borland Staff


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES