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!

Slow starting with parameters

Status
Not open for further replies.

johnbuckley

Technical User
Mar 25, 2002
52
GB
Sorry if this is obvious - I'm a Delphi beginner:

I have a small programme which is a splash screen which shows a small image then runs another exe.

If I hardcode the other exe it works instantly , thus:

procedure TForm1.FormActivate(Sender: TObject);
begin
ExecuteFile('my.exe','','mypath',SW_SHOWMAXIMIZED);
end;

But if I pass the other file in as a start up parameter the splash screen takes about 2 seconds to display, thus:

procedure TForm1.FormActivate(Sender: TObject);
begin
ExecuteFile(paramstr(1),'','mypath',SW_SHOWMAXIMIZED);
end;

What am I doing wrong?



 
hi,

why not integrate the splashscreen with the application you call in the execute. In this case first the called application will be started and after that you will see the splash screen. This is the 2 second delay, the time to start the application.

Steph [bigglasses]
 
Unfortunately the other app is a large graphics app I don't have the code for. It's so slow to load over the network I want the splash screen to show that it is coming.
 
hi,

Try this code :
Create a new application and remove unit1 from the project and add your splash screen to the project.
Replace the code from the project source with the code beneath.

Steph [bigglasses]


program Project1;

uses
Forms,
windows,
shellapi,
splash in 'SplashUnit.pas' {frmSplash};

{$R *.res}

begin
Application.Initialize;
try
frmSplash := TfrmSplash.Create(Application);
frmSplash.Show;
ShellExecute(0, 'open', 'winword.exe', '', '', SW_SHOWMAXIMIZED);
// frmSplash.Hide;
finally
frmSplash.Free;
end;
end.
 
If I understand correctly the delay only occurs when you pass the executatble name as a parameter to your delphi application.
Perhaps you could find another way to get the filename, e.g. write the current name into the registry on each run and retrive it at startup. or write it to a small text file, in both cases you would have to fix some inital value for the filename.
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top