Solved

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

Posted on 2004-09-17
2
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

632 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