disabling the ALT-key

This is a discussion on disabling the ALT-key within the Windows Programming forums, part of the Platform Specific Boards category; I'm creating a fullscreen openGL program, and I've ran into a problem. When I press ALT-SHIFT, my screen turns black. ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    61

    disabling the ALT-key

    I'm creating a fullscreen openGL program, and I've ran into a problem.
    When I press ALT-SHIFT, my screen turns black. Does anyone know how to disable the alt key ?
    Ive tried these , but they don't work.

    Code:
    case WM_SYSKEYDOWN:
        switch (wParam)
        {
        case VK_MENU:
            return 0;
        }
    
    case WM_SYSKEYUP:
        switch (wParam)
        {
        case VK_MENU:
            return 0;
        }
    Code:
    case WM_KEYDOWN:
        switch (wParam)
        {
        case VK_MENU:
            return 0;
        }
    case WM_KEYUP:
        switch (wParam)
        {
        case VK_MENU:
            return 0;
        }

  2. #2
    Handy Andy andyhunter's Avatar
    Join Date
    Dec 2004
    Posts
    540
    Well if your only concerned with ALT-SHIFT combo the problem is that your logic is a little skewed in the wrong direction. The thing is once you press another key with the ALT key pressed the other keycode is contained in wParam and the status of the ALT key is contained in WPARAM. So to disable the ALT_SHIFT combo and everything besides ALT_TAB one would need to set up the message loop like:
    Code:
    case WM_SYSKEYDOWN:
         if(lParam & 0x20000000) //Check for ALT key
              return 0;
         break;
    To disable ALT_Tab requires extra steps as in Windows retains another message queue for such operations.
    i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced

    It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah

    Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    61
    Inserting that in the code doesn't help. Perhaps it would be better to understand your code msdn didn't help though.

    What exactly does the lParam value store ?
    An what doet the 0x20000000 mean in this context ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 09:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21