Advertisement
spacechase0

CTRL + ALT + Q

Sep 14th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. bool isKeyPressed( int key )
  5. {
  6.     return ( GetAsyncKeyState( key ) & 0x8000 ) != 0;
  7. }
  8.  
  9. int main()
  10. {
  11.     while ( true )
  12.     {
  13.         bool control = ( isKeyPressed( VK_LCONTROL ) || isKeyPressed( VK_RCONTROL ) );
  14.         bool alt = ( isKeyPressed( VK_LMENU ) || isKeyPressed( VK_RMENU ) );
  15.         bool q = isKeyPressed( 'Q' );
  16.        
  17.         //std::cout << control << ' ' << alt << ' ' << q << std::endl;
  18.         if ( control and alt and q )
  19.         {
  20.             std::cout << "Pressed!" << std::endl;
  21.             break;
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement