🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by Richard Kavanagh Sun, 28 Jan 2007 20:01
Closing other applications
#2667
Author: Richard Kavanagh
Date: Sun, 28 Jan 2007 20:01
8 lines
1472 bytes
 I wish to nicely close a tree of other processes. I can get their PIDs 
using CreateToolhelp32Snapshot() so I can use TerminateProcess() on each 
one. This is a bit drastic as it can cause up to two hours work to be lost. 
Is there another way? I can find the spawning application, but have no idea 
of the order of the dependencies. ExitProcess() does not seem to work and 
sending a WM_CLOSE message just minimises the main window.
I will be grateful for any clue.
Richard 
Re: Closing other applications
#2669
Author: Remy Lebeau (TeamB)
Date: Mon, 29 Jan 2007 08:00
17 lines
1395 bytes
"Richard Kavanagh" <dd.foldhill@google-ignore-mail.com> wrote in
message news:45bd00e3@newsgroups.borland.com...

> I wish to nicely close a tree of other processes. I can get their
PIDs
> using CreateToolhelp32Snapshot() so I can use TerminateProcess()
> on each one. This is a bit drastic as it can cause up to two hours
work
> to be lost. Is there another way?

Use EnumWindows() and GetWindowThreadProcessId() to find all of the
HWNs that belong to those processes.  Then you can send WM_CLOSE
and/or WM_QUIT messages to them.


Gambit
Re: Closing other applications
#2670
Author: Richard Kavanagh
Date: Mon, 29 Jan 2007 11:14
9 lines
1388 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:45bdaa0c@newsgroups.borland.com...
> Use EnumWindows() and GetWindowThreadProcessId() to find all of the
> HWNs that belong to those processes.  Then you can send WM_CLOSE
> and/or WM_QUIT messages to them.

Works perfectly. Thank you.
Richard 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads