Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Closing consoles running apps

Closing consoles running apps

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionlearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GraemeS
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • G 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

      N Offline
      N Offline
      ng kok chuan
      wrote on last edited by
      #2

      erm, wouldn't ctrl-break solve the problem? it'll terminate the program, if that's all that u're looking for.

      G 1 Reply Last reply
      0
      • N ng kok chuan

        erm, wouldn't ctrl-break solve the problem? it'll terminate the program, if that's all that u're looking for.

        G Offline
        G Offline
        GraemeS
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups