0

How to use arrow keys through getch.

i am in middle of project("Notepad"). i am using graphics.h toh make it in graphical wah. getch is included in graphics.h library. But i am unable to get work from arrow keys. what should i do ??

2nd Mar 2018, 8:41 PM
Muhammad Bilal
Muhammad Bilal - avatar
7 Answers
+ 1
Well brother, i will ask professor if there's another solution. Btw thanks for your time
2nd Mar 2018, 9:21 PM
Muhammad Bilal
Muhammad Bilal - avatar
0
find the unicode representaion. When you kbhit(), output the value of getch() and press the arrow keys. Now use those numbers!
2nd Mar 2018, 8:59 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
0
dude, i have already tried this.. but the thing is the other keys like N,H,K whose ascii are same as arrow keys also got pressed ...it is due to kbhit!!
2nd Mar 2018, 9:08 PM
Muhammad Bilal
Muhammad Bilal - avatar
0
aw well maybe use windows API GetASyncKeyState()
2nd Mar 2018, 9:11 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
0
yes .. but i cannot change my whole code now !!! i have used getch everywhere !!plus use of async key is complex!
2nd Mar 2018, 9:13 PM
Muhammad Bilal
Muhammad Bilal - avatar
0
Darn. Well IDK what to tell you now, sorry. If the project isn't too big, copy it and try GetASyncKeyState. It only requires the key macro e.g. if getasync( VK_Left) do this.
2nd Mar 2018, 9:19 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar
0
Alright good luck and no problem; always happy to help!
2nd Mar 2018, 9:30 PM
「HAPPY TO HELP」
「HAPPY TO HELP」 - avatar