How to use arrow keys through getch. | Sololearn: Learn to code for FREE!

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 ??

3/2/2018 8:41:06 PM

Muhammad Bilal

7 Answers

New Answer

+1

Well brother, i will ask professor if there's another solution. Btw thanks for your time

0

find the unicode representaion. When you kbhit(), output the value of getch() and press the arrow keys. Now use those numbers!

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!!

0

aw well maybe use windows API GetASyncKeyState()

0

yes .. but i cannot change my whole code now !!! i have used getch everywhere !!plus use of async key is complex!

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.

0

Alright good luck and no problem; always happy to help!