🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: ShellExecute

#17120
From: Remy Lebeau (TeamB)
Date: Thu, 10 Apr 2003 03:02
19 lines
1910 bytes
"nicolasr" <nicolasrNOSPAMATSIGNgmx.net> wrote in message
news:3e94cd3c$1@newsgroups.borland.com...

> I just tested to launch a program with ShellExecute() and close it
> with TerminateProcess() which needs the process handle. I used
> FindWindow() to get the handle of the programs window, then
> GetWindowThreadProcessId() to obtain the process ID. Then
> I stumbled across the OpenProcess() API and this seems to
> return the process handle. At least the call to TerminateProcess()
> worked...

Had you used CreateProcess() instead of ShellExecute(), you would have
already had both the process ID and process handle immediately, as
CreateProcess() returns both of them directly, instead of you needing to
"hunt" for them manually.


Gambit
Technical Details
Message-ID: <3e94df2c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e8c0ea4@newsgroups.borland.com> <3e8c5793$1@newsgroups.borland.com> <3e8c5dce@newsgroups.borland.com> <3e8c7d44@newsgroups.borland.com> <3e8c8d8f$1@newsgroups.borland.com> <3e8c9481$1@newsgroups.borland.com> <3e8ca60e$2@newsgroups.borland.com> <3e94cd3c$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,bff1fa0e8e8777f2
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-09 20:13:33 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e8c0ea4@newsgroups.borland.com> <3e8c5793$1@newsgroups.borland.com> <3e8c5dce@newsgroups.borland.com> <3e8c7d44@newsgroups.borland.com> <3e8c8d8f$1@newsgroups.borland.com> <3e8c9481$1@newsgroups.borland.com> <3e8ca60e$2@newsgroups.borland.com> <3e94cd3c$1@newsgroups.borland.com>
Subject: Re: ShellExecute
Date: Wed, 9 Apr 2003 20:02:05 -0700
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e94df2c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049943852 207.175.226.26 (9 Apr 2003 20:04:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail