Article View: borland.public.cppbuilder.nativeapi
Article #14674Re: CreateProcess and ExitProcess woes
From: Remy Lebeau (TeamB)
Date: Wed, 06 Aug 2003 16:54
Date: Wed, 06 Aug 2003 16:54
20 lines
1830 bytes
1830 bytes
"JD" <nospam@nospam.com> wrote in message news:3f31157b$1@newsgroups.borland.com... > Use CreateProcess(). It returns the thread and process > IDs for the new process. You can then use EnumWindows() > to look for all windows belonging to that process. Inside > the callback function for EnumWindows(), you can use > GetWindowThreadProcessId() to get the process ID for > a given window, compare it to the process ID of the original > process spawned, and if they match then use SendMessage() > to send a WM_CLOSE message to each window. The only thing to be careful of is if the process has no windows at all. In which case, you'll just have to use TerminateProcess() since you have no other way to communicate with the process to have to terminate itself more gracefully. At least that I know of. Gambit
Technical Details
Message-ID:
<3f31315d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f31016b@newsgroups.borland.com> <3f31157b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,e076c50d5b2e440a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-08-06 10:10:36 PST From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f31016b@newsgroups.borland.com> <3f31157b$1@newsgroups.borland.com> Subject: Re: CreateProcess and ExitProcess woes Date: Wed, 6 Aug 2003 09:54:46 -0700 Lines: 22 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.1106 NNTP-Posting-Host: 207.175.226.26 Message-ID: <3f31315d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1060188509 207.175.226.26 (6 Aug 2003 09:48:29 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail