Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8506719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:40:06+00:00 2026-06-11T02:40:06+00:00

In my hook procedure (for keyboard) when I click right alt it sends me

  • 0

In my hook procedure (for keyboard) when I click right alt it sends me two codes on press and two on release:

The code:

LRESULT CALLBACK Recorder::keyboardHookProcedure( int code, WPARAM wParam, LPARAM lParam ) {
    if( code < 0 )
        return CallNextHookEx( m_mouseHook, code, wParam, lParam );   

    DWORD _vkCode = reinterpret_cast<KBDLLHOOKSTRUCT*>( lParam )->vkCode;

    qDebug( "vkCode: %d, wparam: %d, lparam: %d", _vkCode, wParam, lParam );

    return CallNextHookEx( 0, code, wParam, lParam );
}

on pressing

vkCode: 162, wparam: 260, lparam: 3398032
vkCode: 165, wparam: 260, lparam: 3398032

on releasing

vkCode: 162, wparam: 257, lparam: 3398032
vkCode: 165, wparam: 257, lparam: 3398032

moreover, notice that when you press the key it sends it as WM_SYSKEYDOWN (260), but when you release it the wParam is WM_KEYUP (257). What the…? Why does it work in such way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:40:08+00:00Added an answer on June 11, 2026 at 2:40 am

    It’s because the right alt-key (ALT-GR) is a shortcut for two keys – ALT and CTRL

    You get WM_SYSKEYDOWN but WM_KEYUP because that’s how the messages are defined – if you’re expecting WM_SYSKEYUP, you get that when you release a key that is pressed in conjunction with the ALT key – http://msdn.microsoft.com/en-us/library/windows/desktop/ms646287(v=vs.85).aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app which uses a keyboard hook procedure in a library. The
I've tried using a global hook but the hookprocedure only recieved window procedure messages
I have successfully gotten my low-level mouse hook code to work, but there are
I am using SetWindowsHookEx() to create a keyboard hook. The creation seems to be
Referring to the Netfilter hook code at this page The port to be checked
My Application contains ole widgets.To handle ole widgets , I use mouse hook procedure
In a Windows native DLL running inside an application, I've installed a keyboard hook
I have setup a hook on WM_SETTEXT message using WH_CALLWNDPROC. In hook procedure CWPSTRUCT*
If I can hook into a Win32 process, will I be able to do:
When answering Git pull hook script which executes locally , I stumbled upon the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.