----- Original Message -----
From: "vss" <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 3:07 PM
Subject: [DUG]: Execute and wait


> Hi All.
> I have a bit of code that does an execute and waits for the app. to
> close.
> What I want to do is execute a game and know when its finished, BUT when
> I use my code, it starts to execute the app, but then it stops and
> returns an error code of zero which means its finished...BUT it never
> started.

Your code looks basically ok.  It's similar to code I've written before for
similar purpose.

Since the app you're trying to run isn't, can you confirm that
CreateProcess() is returning a non-zero value?  If not, check for whitespace
in your application path that might be misinterpreted by CreateProcess()
while it's searching for the exe name, and wrap the name in quotes if
necessary.

Also, your application may be failing to start because you haven't provided
the correct current directory for it.  You could do an ExtractFilePath(Path)
into a string, then pass a PChar from the string as the lpCurrentDirectory
parameter to CreateProcess().

Apart from that... can you give any more information?

--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur."

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to