🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4128

Re: How to check status of app launched by ShellExecuteEx()

#4128
From: Wiebe Vos
Date: Mon, 20 Mar 2006 18:26
50 lines
2540 bytes
Thanks Remy,

> You should be using CreateProcess() instead.
   I did, works fine now.
   However, how can I hide the DOS window?
   (Probably via STARTUPINFO, but I can't figure out how)

> You should not be using TerminateProcess()
    I have to I think. It is a console app with no windowhandle to go after.

> Why are you not letting the process terminate itself normally?
    It does not. It's a 3rd party app that terminates itself only if
    unaltered information appears after a certain period of time)

> Use GetExitCodeProcess().
   That does it.

Wiebe

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schreef in bericht 
news:441e0231$1@newsgroups.borland.com...
>
> "Wiebe Vos" <wiebe@foxware.nl> wrote in message
> news:441dc83a@newsgroups.borland.com...
>
>> I launch a (console) app via ShellExecuteEx()
>
> You should be using CreateProcess() instead.  Don't use ShellExecute/Ex() 
> to
> lanch .exe files directly.  You should only use it to launch data files 
> when
> you don't know ahead of time which .exe will open them.
>
>> and use the hProcess handle in SHELLEXECUTEINFO to
>> terminate it later via TerminateProcess().
>
> You should not be using TerminateProcess() at all, unless absolutely
> necessary.  TerminateProcess() is a brute-force termination.  Why are you
> not letting the process terminate itself normally?
>
>> How can I check in the meantime if the app is still running
>> and not been terminated by someone else?
>
> Use GetExitCodeProcess().
>
>
> Gambit
>
>
> 
Technical Details
Message-ID: <441ef3fd@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <441dc83a@newsgroups.borland.com> <441e0231$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,380f727a338f7f53
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Wiebe Vos" <wiebe@foxware.nl>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <441dc83a@newsgroups.borland.com> <441e0231$1@newsgroups.borland.com>
Subject: Re: How to check status of app launched by ShellExecuteEx() 
Date: Mon, 20 Mar 2006 19:26:56 +0100
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 62.131.171.202
Message-ID: <441ef3fd@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1142879229 62.131.171.202 (20 Mar 2006 10:27:09 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail