Solved

Splash page in Delphi

Posted on 2001-06-12
8
733 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:Mohammed Nasman
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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
 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

776 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