Can you help me with ending/terminating of a program at any point?

[b][red]This message was edited by trauts at 2002-9-30 14:32:5[/red][/b][hr]
I saw this earlier post (http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=3&MsgID=69898&Setting=A9999F0006)
and since I'm new to C++ (I've done basic), I thought that a variation of it would be nice, since a lot of my programs are really annoying.

How might I set it up so that no matter where in the program it is, if the keys "Alt+F4" are pressed, it will immediately end the program? Using the code at the abovementioned post, I could get "Q" to close at a particular point.

I'm using Microsoft VC++ 6.0 as my compiler, and I am working on a WIN32 Console Application. Feel free to email me. (trauts@ebipm.net)








Comments

  • : [b][red]This message was edited by trauts at 2002-9-30 14:32:5[/red][/b][hr]
    : I saw this earlier post (http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=3&MsgID=69898&Setting=A9999F0006)
    : and since I'm new to C++ (I've done basic), I thought that a variation of it would be nice, since a lot of my programs are really annoying.
    :
    : How might I set it up so that no matter where in the program it is, if the keys "Alt+F4" are pressed, it will immediately end the program? Using the code at the abovementioned post, I could get "Q" to close at a particular point.
    :
    : I'm using Microsoft VC++ 6.0 as my compiler, and I am working on a WIN32 Console Application. Feel free to email me. (trauts@ebipm.net)
    :

    Console programs typically terminate when you press Ctrl-C you can also try Ctrl-Break.

    "We can't do nothing and think someone else will make it right."
    -Kyoto Now, Bad Religion


  • : How might I set it up so that no matter where in the program it is, if the keys "Alt+F4" are pressed, it will immediately end the program? Using the code at the abovementioned post, I could get "Q" to close at a particular point.
    :
    : I'm using Microsoft VC++ 6.0 as my compiler, and I am working on a WIN32 Console Application. Feel free to email me. (trauts@ebipm.net)
    :

    just an idea - use a second thread to do the work and keep the main one for processing user messages.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories