Generate mouse/keyboard events from your mouse.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
interception/MouseDll/keyboardState.hpp

67 lines
1.5 KiB

#ifndef KEYBOARDSTATE_HPP
#define KEYBOARDSTATE_HPP
#include <string>
#include <iosfwd>
class CSendInput ;
// ---------------------------------------------------------------------
// Represents the state of special keys.
class KeyboardState
{
// data types:
public:
enum eKeyModifiers { kmCtrl=0x0001 , kmAlt=0x0002 , kmShift=0x0004 , kmCapsLock=0x0008 } ;
// constructors/destructor:
public:
explicit KeyboardState( int flags ) ;
// access methods:
public:
bool isCtrlDown() const ;
bool isAltDown() const ;
bool isShiftDown() const ;
bool isCapsLockDown() const ;
bool isAnythingDown() const ;
std::string asString() const ;
// keyboard state methods:
public:
static KeyboardState getCurrKeyboardState() ;
// operators:
public:
bool operator==( const KeyboardState& rhs ) const ;
bool operator!=( const KeyboardState& rhs ) const ;
// data members:
private:
int mFlags ;
} ;
// inserters:
std::ostream& operator<<( std::ostream& , const KeyboardState& ) ;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// This guard class lets us temporarily change the state of special keys.
struct KeyboardStateGuard
{
KeyboardStateGuard( CSendInput& rSendInput , const KeyboardState& newKeyboardState ) ;
~KeyboardStateGuard() ;
private:
CSendInput& mrSendInput ;
KeyboardState mPrevKeyboardState ;
KeyboardState mNewKeyboardState ;
} ;
// ---------------------------------------------------------------------
#endif // KEYBOARDSTATE_HPP