Closing consoles running apps
-
Hi, I was wondering if anyone knows of a simple way to force a console to close - even if it's running an application. I have no problem finding the consoles (with EnumWindows, using GetClassName etc.), but of course I can't close them if they are currently running an application (which I also want terminated). Is there anyway to automatically do this, or at least to easily find the associated application that I can then kill first? Thanks. GraemeS
-
Hi, I was wondering if anyone knows of a simple way to force a console to close - even if it's running an application. I have no problem finding the consoles (with EnumWindows, using GetClassName etc.), but of course I can't close them if they are currently running an application (which I also want terminated). Is there anyway to automatically do this, or at least to easily find the associated application that I can then kill first? Thanks. GraemeS
erm, wouldn't ctrl-break solve the problem? it'll terminate the program, if that's all that u're looking for.
-
erm, wouldn't ctrl-break solve the problem? it'll terminate the program, if that's all that u're looking for.
I don't think I spelt the problem out clearly enough. I'm trying to close consoles that were not launched by my program (it's actually a complex simulation - and when I want to stop it I have to work through the taskbar manually closing up to 10 console apps). In other words, calls like GenerateConsoleCtrlEvent(..) won't help, since the console I'm trying to close isn't shared by my calling program. I could do something a little more cumbersome (e.g. build a list of running processes and manually select those that need to be killed), but I was looking for a single "click" shortcut that would kill all the consoles (and their apps) for me. Any suggestions would thus be most appreciated. GraemeS