My problem is with Win2000. Its command prompt window property page doesn't have a "warn if still active" option to uncheck and so we are unable to shut it down programmatically.
Is there a work around, another API call, or technique for one application to programmatically shut down a command prompt window?
What an interesting dilemma. After poking around a bit, I'm not really sure there is a clean way to do it. The best piece of advice came from an article on the Microsoft KnowledgeBase, "HOWTO: Terminate an Application "Cleanly" in Win32", (http://support.microsoft.com/default.aspx?scid=kb;EN-US;q178893). Since you control the startup of those DOS applications you can start them in their own copies of NTDVM.EXE, the NT DOS Virtual Machine, where all 16-bit applications run. When it's time to kill the app, you can probably just kill that specific instance of NTVDM.EXE you spawned with TerminateProcess. It's not pretty to call TerminateProcess, but it will work!
This was first published in December 2001