Board index » cppbuilder » Closing other applications

Closing other applications


2007-01-29 04:01:13 AM
cppbuilder26
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

"Richard Kavanagh" < XXXX@XXXXX.COM >wrote in
message news: XXXX@XXXXX.COM ...
Quote
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

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
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
 

{smallsort}