none
Alt key virtual codes

    Question

  • Inspecting the `Right Alt` key messages using `Microsoft Spy++` returns the following:

    WM_KEYDOWN nVirtKey:VK_CONTROL

    WM_KEYDOWN nVirtKey:VK_MENU

    WM_SYSKEYUP nVirtKey:VK_CONTROL

    WM_KEYUP nVirtKey:VK_MENU




    Why does the key generate 2 messages `VK_CONTROL` and `VK_MENU`? Why is the type of `VK_CONTROL` SYS (system) while `VK_MENU` non-system?

    • Edited by Mulligan81 Thursday, April 26, 2018 9:35 AM
    Thursday, April 26, 2018 9:34 AM

All replies

  • Hi Mulligan81,

    Actually it would be not the VS IDE usage issue, it would be related to the Keyboard and Mouse Input.

    Like the following document which shared useful information:

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms646287(v=vs.85).aspx

    The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the F10 key or the ALT key was released. The wParam parameter of the message is set to SC_KEYMENU.

    When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 27, 2018 2:53 AM
    Moderator