Problem solve Get help with specific problems with your technologies, process and projects.

How can we work around Win2k not having a "warn if still active" option to uncheck so we can shut do

We have an application that in some processes needs to spawn another task via the shell command. When these shelled tasks happen to be DOS applications, our software will decide when it is time to shut them down via the SendMessage() API call and the WM_CLOSE transaction. This works fine under Win95, Win98, WinME as long as the DOS window property "warn if still active" is unchecked.

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!

Dig Deeper on Enterprise infrastructure management

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.