Hello,
you have already asked this question some days before:
how-to-get-a-notice-when-a-up-aroow-key-is-pressed.html
The answer there is correct.
Regards, Guido
How to get a notice when a up arrow key is pressed in C language
Hi, I like to move a picture on the screen by clicking up, down, right, left arrow on the key board. Is there a way to get a notice in my software when “up arrow key” in keyboard is pressed, as an example. I tried bres=IsInputKey(0); How do I find out what key number is “up-arrow” Is this a right approach, I wonder. I use C, and C++ Languages on the platform of Windows10 and Visual studio 2017 Thank you in advance ChangChiTheGraphics
Developer technologies | C++
2 answers
Sort by: Most helpful
-
Guido Franzke 2,191 Reputation points
2021-03-02T06:58:07.1+00:00 -
Sam of Simple Samples 5,546 Reputation points
2021-03-03T19:39:53.913+00:00 You still have not said what type of project it is but since you say C (not C++) the implication is that it is a console program. See Reading Input Buffer Events - Windows Console. Try the sample program. There is much to learn but you can develop a relatively sophisticated text-mode UI Using the Console. That sample uses the
KeyEventProc
. In that when the arrow-up key is pressedker.dwControlKeyState
will beENHANCED_KEY
andker.uChar.AsciiChar
will be VK_UP.