Solved

How to start a exe when the first exe is done?

Posted on 2004-09-17
2
143 Views
Last Modified: 2011-04-14
Hello i am doing an intro to a game, and my program first to play up a video.exe file. I am using bink so its a exe. And when that exe is done, I want a game.exe to start. I tried with

run := FindWindow('BinkWin', 'Bink Video Player');
if run < 1 then
//start game

without sucsess, Have someone an idé?
0
Comment
Question by:fjocke
2 Comments
 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 150 total points
ID: 12088759
function CreateProcessSimple(sExecutableFilePath : string ):DWORD
  var
   pi: TProcessInformation;
   si: TStartupInfo;
  begin
   FillMemory( @si, sizeof( si ), 0 );
   si.cb := sizeof( si );
   try
    CreateProcess(Nil, PChar( sExecutableFilePath ),
                  Nil, Nil, False, NORMAL_PRIORITY_CLASS,
                  Nil, Nil, si, pi );

   WaitForSingleObject(pi.hProcess, INFINITE);
   finally
   CloseHandle( pi.hProcess );
   CloseHandle( pi.hThread );
   end;
end;

use it as
CreateProcessSimple(BinkWin.exe);
//when it will finishes then
// Start game
0
 
LVL 6

Expert Comment

by:Sergio_Hdez
ID: 12110287
If the first exe is in HD (not CD) maybe you can also try to open it as a file in "exclusive" mode, so as long as it is executing, you will fail (try finally loop) and it you success, then you know the process have finished... but better try the Ferruccio68 way first, it is the good one!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
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…

708 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

21 Experts available now in Live!

Get 1:1 Help Now