in reply to Re: Killing a process on Windows (Win32::Process question)
in thread Killing a process on Windows (Win32::Process question)

How do you tell the program to shut down gracefully? If it's a GUI program, posting the proper message to the main window, or perhaps broadcasting it to be save, is my first step.

The problem is that I don't know anything about the process to be killed. In theory, it could be anything. In practice, it is very often a (non-GUI) C++ application, which has run on a CASSERT, which in turn pops up a message box, and the process waits forever that some kind soul would click the message box away. But this is only the "typical" scenario, not the only one. The reason is that I don't write the applications which run into those processes, so I can't know in advance what they are going to do....

-- 
Ronald Fischer <ynnor@mm.st>

Replies are listed 'Best First'.
Re^3: Killing a process on Windows (Win32::Process question)
by John M. Dlugosz (Monsignor) on May 15, 2009 at 17:53 UTC
    Ah, then you really want to look for popup-killers. There are ways to prevent modal dialog boxes from appearing at all. This is used on services and servers that are sloppy or incorporate parts that were not so-designed.

    You can also be more targeted, noticing that the process has a window of the expected Class to be that popup, and feeding it a message. I think some popup-killers work that way, after the fact. Others prevent them from working in the first place.

    —John