Win32 API to check shift state


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Header Declared in Winuser.h, include Windows.h
  2. // Import library User32.lib
  3.  
  4.  
  5. // Look for a shift key to be pressed.
  6. // '& 0x8000' tests the high-order bit. 1=key is down; 0=up.
  7. // '!!' will bool-ize the result.
  8. bool shift = !!( ::GetKeyState(VK_SHIFT) & 0x8000 );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.