Esc menu

I am currently doing a school project. we are allowed to anything as long as it meets the requirements. i have it finished but i want to add something so wherever you are in the code you can press escape and open up a menu that allows you to exit the section of code you are in. is there anyway to do this without pausing the program and asking the user?
In order to do that you have to have an event loop running.

Is your school project the usual console application?
Or is it a GUI?
Can always.. Alt + F4 ;)

You need to run two threads; one main thread and one thread waiting for you to press escape. You've got to use some operating system API/user-written library for the 'waiting to press escape' part, because you can't do this with just the standard library.

Anyways if it's a console program and you don't know about threading yet, then I say don't bother and look for other places where you can improve.

edit: Didn't realize I was in Windows Programming.
Last edited on
Registered users can post here. Sign in or register to post.