🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: GetExitCodeProcess

#10449
From: Bob Gonder
Date: Thu, 08 Apr 2004 18:12
19 lines
1827 bytes
Karsten Becker wrote:

>With OpenProcess() I'm getting the handle of the program i have triggered

Are you sure about that?

>and then i check with GetExitCode wether that program is alive or not. This
>is the point where it goes wrong.
>The GetExitCodeProcess returns the correct status on WinXP but on Win2K it
>fails. It returns 0.
>My question now is why? Am i missing something? How should i solve this
>problem?

You don't check the process handle for NULL.
If the process has finished before you call OpenProcess, I would
expect you wouldn't get what you want. You might even get a different
program as Windows recycles process ids.
If you use CreateProcess instead, and keep the handle around until the
subprogram ends, then you don't have these problems.
Technical Details
Message-ID: <vp4b70dl0kukdc6hj55ntg2bd2ovs34675@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4075429c@newsgroups.borland.com> <407584c9$1@newsgroups.borland.com> <407587a4@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9f115a8db4592134
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-04-08 11:40:30 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: GetExitCodeProcess
Date: Thu, 08 Apr 2004 11:12:04 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <vp4b70dl0kukdc6hj55ntg2bd2ovs34675@4ax.com>
References: <4075429c@newsgroups.borland.com> <407584c9$1@newsgroups.borland.com> <407587a4@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 4.228.219.229
X-Trace: newsgroups.borland.com 1081447924 4.228.219.229 (8 Apr 2004 11:12:04 -0800)
Lines: 21
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail