Article View: borland.public.cppbuilder.nativeapi
Article #10451Re: GetExitCodeProcess
From: Karsten Becker
Date: Thu, 08 Apr 2004 19:22
Date: Thu, 08 Apr 2004 19:22
27 lines
1966 bytes
1966 bytes
Thanks Bob.... i was blind :-/ "Bob Gonder" <notbg@notmindspring.invalid> schreef in bericht news:vp4b70dl0kukdc6hj55ntg2bd2ovs34675@4ax.com... > 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:
<4075a658$1@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-mailReferences:
<4075429c@newsgroups.borland.com> <407584c9$1@newsgroups.borland.com> <407587a4@newsgroups.borland.com> <vp4b70dl0kukdc6hj55ntg2bd2ovs34675@4ax.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 12:40:25 PST From: "Karsten Becker" <Kars@test.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4075429c@newsgroups.borland.com> <407584c9$1@newsgroups.borland.com> <407587a4@newsgroups.borland.com> <vp4b70dl0kukdc6hj55ntg2bd2ovs34675@4ax.com> Subject: Re: GetExitCodeProcess Date: Thu, 8 Apr 2004 21:22:25 +0200 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 NNTP-Posting-Host: 213.84.117.173 Message-ID: <4075a658$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1081452120 213.84.117.173 (8 Apr 2004 12:22:00 -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