Article View: borland.public.cppbuilder.nativeapi
Article #12808Re: Closing another program
From: Bob Gonder
Date: Tue, 18 Nov 2003 17:01
Date: Tue, 18 Nov 2003 17:01
14 lines
1480 bytes
1480 bytes
Eelke Klein wrote: >My program starts another program. Of this program I have the >process handle. > >What is the best way to close this other program? > >I was thinking about sending a WM_CLOSE message but I need the >Window handle for this. Use the ProcessHandle to get the ProcessID. Use EnumWindows() and in the EnumProc, use GetWindowThreadProcessId() to get the ProcessID for the hWnd, and see if it matches the Proccess ID you have. If it does, then that's the window of your sub-process.
Technical Details
Message-ID:
<5hjkrvc8sljb887ni7t0geolt5m9fcmer3@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3fba0c7c@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,36f59e3e03394bfd X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-18 09:10:10 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Closing another program Date: Tue, 18 Nov 2003 09:01:46 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <5hjkrvc8sljb887ni7t0geolt5m9fcmer3@4ax.com> References: <3fba0c7c@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: 67.31.165.169 X-Trace: newsgroups.borland.com 1069174907 67.31.165.169 (18 Nov 2003 09:01:47 -0700) Lines: 17 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail