Is there any way to disable CTRL+S using ReadConsoleInput()?

Hello.

I've been working on a console-based game for many years, and I've managed to kill nearly all issues pertaining to input, aside from one: CTRL+S. I use ReadConsoleInput() to ..read.. the console.. input, and I'd like to open up that key combination so it can be used in-game, or, at the very least, I'd like to ignore it, so it won't freeze the screen.

The Internet at large has completely failed me, so I come to you, kind CPlusPlus.com denizens.

If you have any advice, please bestow it upon me.

And let me pre-empt the inevitable "Console windows aren't made for this kind of thing" by saying, "That's the point."
Well... whaddaya know. I managed to find my answer buried in something I'd have thought was unrelated.

http://www.cplusplus.com/forum/beginner/3329/#msg13776

I just set my hIn parameters to 0, as is done in the above code, and voila! No more CTRL+S.

Hopefully this information will help out someone else going forward. At least, searching for CTRL+S om this site will direct people here. So, for clarity, here's the answer:

#include "windows.h" //specifically, wincon.h

SetConsoleMode(hIn,0);

It gets rid of CTRL+C as well (although I had already managed that). CTRL+BREAK remains functional, however, as it should.
Last edited on
Topic archived. No new replies allowed.