🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CreateProcess and ExitProcess woes

#14671
From: JD
Date: Wed, 06 Aug 2003 14:49
17 lines
1547 bytes
"Mark D" <m.davCROPHEREenport@ntlworld.com> wrote:
>
>I neeed to launch an app and close it from within my app [...]

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.

<Gambit>

~ JD
Technical Details
Message-ID: <3f31157b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f31016b@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 08:10:57 PST
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: CreateProcess and ExitProcess woes
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 172.149.88.20 172.149.88.20    
References:  <3f31016b@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f31157b$1@newsgroups.borland.com>
Date: 6 Aug 2003 07:49:31 -0700
X-Trace: newsgroups.borland.com 1060181371 207.105.83.65 (6 Aug 2003 07:49:31 -0700)
Lines: 18
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail