Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing splash screens 2

Status
Not open for further replies.

cwolgamott

Programmer
May 29, 2002
69
US
Hello. :) I am modifying some forms in Delphi. I need to close the splash screen that appears at the beginning when it is first loaded when the next form appears. Here is the code that I am currently trying:

procedure Tfsplash.FormShow(Sender: TObject);
const
InfoNum = 1;
InfoStr: array[1..InfoNum] of string = ('FileVersion');
var
S: string;
n, Len, i: DWORD;
Buf: PChar;
Value: PChar;
Value2: array[1..InfoNum] of PChar;
begin
S := Application.ExeName;
n := GetFileVersionInfoSize(PChar(S), n);
if n > 0 then
begin
Buf := AllocMem(n);
//Memo1.Lines.Add('VersionInfoSize = ' + IntToStr(n));
GetFileVersionInfo(PChar(S), 0, n, Buf);
for i := 1 to InfoNum do
if (VerQueryValue(Buf, PChar('StringFileInfo\040904E4\' + InfoStr), Pointer(Value), Len)) then
label4.Caption := 'Version: ' + value;
//Memo1.Lines.Add(InfoStr + ' = ' + Value);
FreeMem(Buf, n);
end
else
label4.caption := 'Version n/a';
end;

procedure Tfsplash.FormClose(Sender: TObject);
begin
fsplash.Hide;
fsplash.Free;
end;

However, I am new to Delphi and am unsure of where to call FormClose in the Object Inspector. I would greatly appreciate any suggestions. :) Thank you. :)
 
A better way of displaying a splash screen is to remove the form from the auto create (Project, then options from the main menu) and place the following code in the projects source code (Project then View Source).

SplashForm := TSplashForm.Create(Application);
SplashForm.Show;
SplashForm.Update;

{Forms creation code in here}

SplashForm.Hide;
SplashForm.Free;
 
Thank you so much for your response. :) I greatly appreciate it. :)
 
Thanx Eric!!!

I have been trying to find an example of splash scrfeens for ages now and this works perfectly!!!!

Cheers!!!
 
You may want to put a sleep before the Hide

Example

SplashForm := TSplashForm.Create(Application);
SplashForm.Show;
SplashForm.Update;

{Forms creation code in here}

Sleep(2000) // Sleep(2000) waits 2 Seconds (1/1000th of Sec)
SplashForm.Hide;
SplashForm.Free;



Kind Regards, Paul Benn

**** Never Giveup, keep trying, the answer is out there!!! ****
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top