Get the 30th bit of lParam parameter in WM_KEYDOWN message

I need to get the 30th bit of the lParam parameter passed with the WM_KEYDOWN message. This bit written here lets me know if a key has been pressed before. Is this code correct for retrieving it?

(lParam >> 30) & 1
+3
source share
1 answer

I would just use it lParam & 0x40000000. If this is a nonzero value, then b30it was established (I believe that the thirty-first bit of thirty-two, by the way, by the way). And the likelihood that this will be an operation {logical-and, compare}, not {shift, logical-and, compare}.

, , , (lParam >> 30) & 1, ?

+8