I'm writing a software and for user input I need to avoid the use of some keys, my actual function is this
In this code is only reported VK_INSERT to not work, but it's the same with VK_PRIOR, VK_NEXT, VK_HOME, VK_DEL, VK_END, VK_LEFT, VK_RIGHT, VK_UP, VK_DOWNCode:char * UserInput(int max, int tipo) { ... while(!EndInput) { current = getch(); switch(current) { case VK_RETURN: //ok, capture enter key and do its job ... break; case VK_BACK: //ok, capture backspace and do its job ... break; case VK_TAB: //ok, makes TAB key do nothing break; case VK_INSERT: //Don't capture INS key returns òR as output //getch(); break; case 0: //ok, makes functions keys do nothing getch(); case VK_ESCAPE: //ok, capture ESC and do its job ... default: ... break; } } return buff; }
How could I capture these keys to let them do nothing?
You could make a keyboard hook for your program, which handles all the keys being pressed. This shows you how to install a keyboard hook, and disable the PageDown-key using the hook.
I've solved by using a:
case -32: getch(); break;
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks