🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

GetExitCodeProcess

#10433
From: Karsten Becker
Date: Thu, 08 Apr 2004 12:16
28 lines
1742 bytes
Hi all.

In my program i start another application by spawnlp. I'm getting an
processID back. Now i check every 5 seconds whether that second application
has closed or not with the code below.

HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS | PROCESS_TERMINATE |
PROCESS_QUERY_INFORMATION, false, dW);
DWORD status = STILL_ACTIVE;
int Ret = GetExitCodeProcess(hProcess, &status);
if (status!=STILL_ACTIVE)
{
....
}

Here's my question:
When i'm running that code under WinXP the GetExitCodeProcess returns a non
zero number and the status is unequal to STILL_ACTIVE and thats how it
should be.
When i'm running that code under Win200 Prof. the GetExitCodeProcess returns
0 and the status stays STILL_ACTIVE even when the second program isn't in
the processlist any more.

What am I doing wrong here? Do i have to add another flag to OpenProcess
when running under win2K?

Thanks
Karsten
Technical Details
Message-ID: <4075429c@newsgroups.borland.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

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9f115a8db4592134,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-04-08 05:40:08 PST
From: "Karsten Becker" <Kars@home.nl>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: GetExitCodeProcess
Date: Thu, 8 Apr 2004 14:16:27 +0200
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 194.171.5.82
Message-ID: <4075429c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1081426588 194.171.5.82 (8 Apr 2004 05:16:28 -0800)
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