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

  • SEARCH
  • Home
  • 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 6235085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:36:33+00:00 2026-05-24T10:36:33+00:00

I am examining the value of a LPARAM when I receive the WM_KEYDOWN event.

  • 0

I am examining the value of a LPARAM when I receive the WM_KEYDOWN event. But I am unsure that I am correctly examining the 1st 16 bits then the next 8 bits & so on. This is how MSDN explains a LPARAM is organised for a WM_KEYDOWN msg: http://msdn.microsoft.com/en-us/library/ms646280(v=vs.85).aspx

Are my bit (splits?) correct?:

void outputLParam( LPARAM lParam )
{
    printf("Repeat Count        : %d\n", (lParam) & ((1L<<16)-1));          // print the value of the 1st 16 bits
    printf("Scan Code           : %d\n", (lParam >> 0x16) & ((1L<<8)-1));   // print the value of the next 8 bits
    printf("Extended Key        : %d\n", lParam & 0x24);                    // print the value of the next bit
    printf("Reserved            : %d\n", (lParam >> 0x25) & ((1L<<4)-1));   // print the value of the next 4 bits
    printf("Context             : %d\n", lParam & 0x29);                    // print the value of the next bit
    printf("Prev Key State      : %d\n", lParam & 0x30);                    // print the value of the next bit
    printf("Transition Key State: %d\n", lParam & 0x31);                    // print the value of the next bit
}
  • 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-05-24T10:36:34+00:00Added an answer on May 24, 2026 at 10:36 am

    Here you go.

    void outputLParam( LPARAM lParam )
    {
        printf("Repeat Count        : %d\n", (lParam) & 0xFFFF);      // print the value of the 1st 16 bits
        printf("Scan Code           : %d\n", (lParam >> 16) & 0xFF);  // print the value of the next 8 bits
        printf("Extended Key        : %d\n", (lParam >> 24) & 0x1);   // print the value of the next bit
        printf("Reserved            : %d\n", (lParam >> 25) & 0xF));  // print the value of the next 4 bits
        printf("Context             : %d\n", (lParam >> 29) & 0x1);   // print the value of the next bit
        printf("Prev Key State      : %d\n", (lParam >> 30) & 0x1);   // print the value of the next bit
        printf("Transition Key State: %d\n", (lParam >> 31) & 0x1);   // print the value of the next bit
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Examining Zend Framework, I found that all setter methods (of those I’ve examined) return
Examining the compiled code of the sinf() on our GCC implementation, I see that
Our environment: Drupal+MySQL Examining the query log indicates that the following query, originating from
I am examining a core dump, and noticed that in one frame the 'this'
I have a time-series that I'm examining for data heterogeneity, and wish to explain
I have been slowly examining all of the features that F# brings to the
I am examining a js file form Bram Jetten: Notification.fn = Notification.prototype; function Notification(value,
I'm trying to write the function matricopy that should copy a matrix but the
I realise that you can easily determine a macs specs by examining the 'About
I am bulk inserting a CSV file into SQL server but after examining 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.