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
}
Here you go.