🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CreateProcess

#8761
From: Bob Gonder
Date: Thu, 23 Sep 2004 17:20
12 lines
1725 bytes
Alfred Thomas wrote:

>I would like to know what the best way is for killing a process created by CreateProcess is. I currently use TerminateProcess but in the Windows help it says that it should only be used in emergencies. ExitProcess doesn't take a handle to the process and kills only the current process.
>So the question is, if I create a process with CreateProcess, how should I close it.

You should have a mechanism for your main program to "talk" to the new
process, so it can tell it to kill itself.

One way is to use the process info you have from CreateProcess, to
find the process window with EnumWindows. Then you could send it a
WM_CLOSE, or a user-defined message that it would respond to, closing
out any open resources, and terminating cleanly.
Technical Details
Message-ID: <dt06l0129so0r6os05c2hh28gcsqv9o0fm@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4152d119$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,40e3f6558dbc9806
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: CreateProcess
Date: Thu, 23 Sep 2004 10:20:39 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <dt06l0129so0r6os05c2hh28gcsqv9o0fm@4ax.com>
References: <4152d119$1@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: 209.179.222.14
X-Trace: newsgroups.borland.com 1095960036 209.179.222.14 (23 Sep 2004 10:20:36 -0700)
Lines: 15
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail