+ Reply to Thread
Results 1 to 3 of 3

Thread: [C] Capture some keys pression

  1. #1
    Learning Programmer Alhazred is an unknown quantity at this point
    Join Date
    Jul 2007
    Posts
    31

    [C] Capture some keys pression

    I'm writing a software and for user input I need to avoid the use of some keys, my actual function is this
    Code:
    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;
    }
    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_DOWN
    How could I capture these keys to let them do nothing?

  2. #2
    Retired v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light v0id is a glorious beacon of light
    Join Date
    Apr 2007
    Posts
    2,978
    Blog Entries
    3
    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.

  3. #3
    Learning Programmer Alhazred is an unknown quantity at this point
    Join Date
    Jul 2007
    Posts
    31
    I've solved by using a:
    case -32: getch(); break;

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Code: Capture Code from USB Camera
    By MrNobody in forum VB Tutorials
    Replies: 71
    Last Post: 08-14-2009, 10:59 AM
  2. Transmitting video capture from server to client (Newbie)
    By MrNobody in forum Visual Basic Programming
    Replies: 30
    Last Post: 05-02-2008, 04:18 PM
  3. caption problem
    By ikkeugh in forum Visual Basic Programming
    Replies: 5
    Last Post: 10-17-2007, 11:16 AM
  4. capture screen shot from an application during run time
    By engr in forum Visual Basic Programming
    Replies: 1
    Last Post: 01-29-2007, 03:38 PM
  5. Capture the screen in a TImage
    By MrDiaz in forum Pascal/Delphi
    Replies: 3
    Last Post: 12-06-2006, 11:57 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts