Hi all, I need a method to intercept the key before it reaches my application ie, I need to trap the keys pressed and convert it to my local language, Malayalam, and then display it in my app thanks and regards
Hi all, I need a method(in C language) to intercept the key before it reaches my application ie, I need to trap the keys pressed and convert it to my local language, Malayalam, and then display it in my app thanks and regards
That code didn't work for me so I modified it. This code will work for any situation that someone needs to use the up arrow, down arrow, left arrow, and right arrow.
The problem with your program is that there is no difference between F1 and a semicolon because they both have the same ascii value. Same with all the other special keys you defined. That's why I added 255 to the ascii value for special keys so that the program would be able to distinguish them from normal keys. Some programmers just make the value of special keys negative, e.g. #defind F1 (-59)
Hello i just signed up for this question. I noticed that it was an old post but I also am making a game application which is going to be a 2D soccer game. I need a KeyListener in C++ which will detect keystrokes immediately. For example, to move a radiobutton a little right when i press right arrow on keyboard. Is the code above can do it? I must detect key stroke immediately (not 1-console input and 2-press enter to continue kind of program) I would really appreciate if any of you can answer me. :)
It might, assuming you don't plan to port the program to another operating system and use a compiler that supports functions in conio.h. conio.h and its associated library are non-standard, which means not all compilers will support it. Too bad because conio.h contains several really useful functions, such as kbhit(). But you can replicate that by using win32 api console functions.