Is it possible to make a program wait for a specific keypress, and ignore others untill this key is pressed?

Hey all.

I made an account to get help here. I'm new to programming (in c++).

I was wondering if there is a way to make a program wait for a specific key press, while ignoring all other key presses until the key I have selected is pressed.
For example, I'm doing a countdown timer program that counts from 30 down to 0, and I would like for it to reset automatically when I press the "v" key. So it would ignore other random key presses until "v" is pressed. Also, it must be doable without having to hit enter as well preferably.

So is this possible? If so, help me out :).

I assume your using windows but idk, if you are i would look into windows API virtual keys.
Last edited on
I am using Windows 7. I've sort of figured out how to make it ignore other key presses, but now my biggest problem is trying to get it to accept the input without the user having to hit enter.

Anyone know how to make it to where the program can accept input without having to hit enter?


EDIT: Also, if you meant that I could accomplish this using the virtual keys, could you explain how I could do this? I've never heard of that before. I'm a noob.
Last edited on
You might be better asking in the windows programming section about this, because what you want to accomplish cant be done with just C++ alone, you need to use the windows API to get keyboard key press input.
Okay. Thanks a lot for your help. I'll ask there.
Topic archived. No new replies allowed.