Главная страница | назад





Article #15533: Showing a splash screen at startup

 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

Last Modified: 01-SEP-99