I know that a LPARAM variable has certain bits set(inside it) that identify information such as long key presses & etc. when I receive a WM_KEYDOWN event.
So I a
LPARAM can hold a pointer value, this is important for 64-bit compatibility.
To examine the nth bit (0 is least significant):
if (lParam & (1 << n)) { /*bit set*/ } else { /* bit not set*/ }
To extract it as either 0 or 1:
(lParam >> n) & 1
To extract X bits from position Y:
(lParam >> Y) & ((1<
This works by first shifting the bytes down to the least significant places and creates a X bit wide mask to mask them out.