> -----Original Message-----
> From: Dido Sevilla [mailto:dido.sevilla / gmail.com] 
> Sent: Friday, September 23, 2005 6:32 AM
> To: ruby-talk ML
> Subject: Re: Trapping TaskManager's kill process on win32
> 
> On 9/23/05, Daniel Berger <djberg96 / gmail.com> wrote:
> > You can't.  Using the "end process" button on the Task Manager calls
> > the TerminateProcess() function, which can't be trapped.  
> Read here for
> > more:
> >
> > http://blogs.msdn.com/oldnewthing/archive/2004/07/22/191123.aspx
> >
> > It's probably a good thing, too.  Imagine if you did this:
> >
> > trap("KILL"){ # Do nothing }
> >
> > How would you kill the process short of rebooting?
> 
> Gee, so there's only a SIGKILL on Windows, and no equivalent of a
> SIGTERM? What if I want the process to try to do some cleanup before
> dying? This is something I do fairly often with my programs on
> GNU/Linux. Now if the cleanup is hosed, obviously I'd expect a kill -9
> to still work of course...

send a WM_QUIT to the main window if you want the application to exit 
gracefully. If it does not respond use TerminateProcess.

(if it has no window, use GenerateConsoleCtrlEvent to send Ctrl-C or
Ctrl-Break)

cheers

Simon