Solved

Splash page in Delphi

Posted on 2001-06-12
8
731 Views
Last Modified: 2012-05-04
Hi Guys!
Here I am again with a question for you.  I have written a short prog in Delphi.  As of yet, I have not created the install disk as I don't appear to have 'Installshield' in my version of Delphi 4- it came as a standard copy on the front of a mag. The first part of the question is, can I download it anywhere on the net?  The second part of the question is, I want to place a splash screen graphic on the front end of the program to open it and one at the end to close it.  C++ has this facility but I cannot see how to do it in Delphi- can someone help please?
0
Comment
Question by:chrisbee
8 Comments
 
LVL 3

Expert Comment

by:nnbbb09
ID: 6183563
Hello,

The Delphi version of Installshield is especially licensed from Installshield Inc which probably excludes them from including it on magazine CD's. I think you can download installshield express from www.installshield.com but you have to pay to register it.

To create a splash screen simply design your splashscreen form and then edit your project sourcecode to read something like this :

  // always create main form first
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TSplashForm, SplashForm);
  SplashForm.show;

  {create other forms/do any other processing here...}

  .
  .
  .

  {destroy splash screen and run application}
  SplashForm.hide;
  SplashForm.free;

  Application.Run;

You will need to make a call to the Update method in the OnActivate event of your splash screen to ensure all paint messages are processed.

hope this helps

Jo
0
 
LVL 1

Accepted Solution

by:
bnemmers earned 200 total points
ID: 6183599
Hello,

Jo was correct but you might want to create your
splash screen on a new thread and create it first.
If you do any type a database connection or itmes that could take some time, and you start these itmes in the OnCreate of the main form it will take some time before the splah screen is created.
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6183938
bnemmers, is what u post is answer?, I don't think that, so it's better to post as comment, cuz u didn't answer chrisbee about what he asked

chrisbee, there are some install programs one of them installshield, but it's not free, but there are some good programs do what install shield do, and they are free, try to use GP-Install, it's free and easy
you can download it from
http://www.qsc.co.uk/gpi/gpinstall.htm

and you will find many programs here
http://homepages.borland.com/torry/tools_install.htm

ok about splash screen
the splash screen idea is easy, just create another form in ur project let's say it's name will be form2, change the property border style to : bsnone
you can add image to the form to make look nice, and add timer to the form2, and put this code in the timer

procedure TForm2.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
end;

also you need to remove the form2 from the auto create form, from project menu choose options  from forms tab remove form2 from auto create to avalible forms

last step, you need to add some code to the project source.
from project menu > view source, you will see the code as the following
//-----
..
..
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

now you need to make some change to code, it will look like this :

..
..
begin
  Application.Initialize;
  form2 := TForm2.Create(application);
  Form2.show;
  Form2.Update;
  while form2.Timer1.Enabled do
    Application.ProcessMessages;
  Application.CreateForm(TForm1, Form1);
  Form2.Hide;
  Form2.free;
  Application.Run;
end.

if you have any problem, send me email to nasman@mogaza.org, and i will send you full sample with code about what you need

Best regards
Mohammed Nasman
0
 
LVL 7

Expert Comment

by:Motaz
ID: 6184820
This about your second part of question, (Splash screen). I copy it form my E-Book (Delphi Programming Guide), motaz1@yahoo.com

---------------------------

Splash screen is a temporary window that appears befor applications completed loading into memory. Most large applications have splash screen such as Delphi. Splash screen always used for large applications and for any application that has a long initialization time such as openning databases. When you use database in your Delphi application and you open a table at main form's-OnCreate event, initializing BDE for openning table at first time takes long time so that instead of letting user keep watching hard disk led and hearing it's heads while your application loaded, it is better to display a splash screen to make him feel that your application is working.

In splash screen you can write some information about your application such as application name, version, date, copyright, and your company name or your name if you are individual.

Build splash screen:

- Start new application.
- Add new form (should be Form2).
- Set Form2 BorderStyle to bsNone.
- Set Form2 Position property to poScreenCenter.
- Drop a Panel in Form2 and make it's Align to alClient.
- At main form (Form1) OnCreate event write:

  Sleep(2000);

This delay simulate application initialization and loading.

- View project file (you can display it by pressing Ctrl + F12 then selecting Project1).
- Project1 code must as text below, new added lines are written in bold face (You can replace Project1 code by below code), you must clear auto-creation for Form2 by one of two methods:

1. At Delphi main menu select (Project/Options/Forms) then remove Form2 from Auto-create forms to Available forms.

2. Also you can delete below line from Project1 file:

  Application.CreateForm(TForm2, Form2);



program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};

{$R *.RES}

var
  Form2: TForm2;

begin
  Form2:= TForm2.Create(nil);
  Form2.Show;
  Form2.Update;
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Form2.Free;
  Application.Run;
end.



----------------------
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 7

Expert Comment

by:Motaz
ID: 6184824
Sorry, the address of this book is www.geocities.com/motaz1

Motaz
0
 

Author Comment

by:chrisbee
ID: 6192424
Hi Guys!
Thanks for the prompt response. I shall study your code and ge back to you all. No doubt you have gathered I am a newby on Delphi. I like the language and want to get into the graphics it uses. Thanks again- I'll be back with the points soon.
Best wishes............chrisbee.
0
 
LVL 2

Expert Comment

by:danysz
ID: 6197220
listening ........
0
 
LVL 3

Expert Comment

by:nnbbb09
ID: 6235524

Not sure you should have awarded the points to bnemmers answer, as he didn't mention anything about installation and only suggested a small improvement to my existing comment.

Jo
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now