Solved

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

Posted on 2004-09-17
2
150 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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