⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 define.txt

📁 VC++ DEMO, used for the beginners and the amour
💻 TXT
字号:

enum
{
	MOUSEKEY_NONE = 0x00,
	MOUSEKEY_LBUTTON = 0x01,
	MOUSEKEY_RBUTTON = 0x02,
	MOUSEKEY_SHIFT   = 0x04,
	MOUSEKEY_CONTROL = 0x08,
	MOUSEKEY_MBUTTON = 0x10,
};

enum
{
	MODIFIER_NONE	= 0x00,
	MODIFIER_CTRL	= 0x01,
	MODIFIER_ALT	= 0x02,
	MODIFIER_SHIFT	= 0x04,
};

enum
{
	KEY_NONE = 0x00,
	KEY_JUSTPRESSED = 0x01,
	KEY_PRESSED = 0x02,
	KEY_JUSTUNPRESSED = 0x04,
};

typedef unsigned char 		ModifierState;

typedef struct _D3DMOUSEKEY
{
	_D3DMOUSEKEY(UINT MouseButton = 0,UINT HotKey = 0)
		: m_MouseX(0),m_MouseY(0),m_MouseButton(MouseButton),m_HotKey(HotKey)
		
	{}

	_D3DMOUSEKEY & operator = (const _D3DMOUSEKEY& Hot)
	{
		m_MouseButton = Hot.m_MouseButton;
		m_HotKey = Hot.m_HotKey;
		m_MouseX = Hot.m_MouseX;
		m_MouseY = Hot.m_MouseY;
		return *this;
	}

	inline bool	  operator < (const _D3DMOUSEKEY & Hot) const
	{
		unsigned int First;
		First = Pack();
		unsigned int Second;
		Second = Hot.Pack();
		return ( First < Second );
	}

	inline bool	  operator == (const _D3DMOUSEKEY & Hot) const
	{ 
		return ((m_MouseButton == Hot.m_MouseButton)&&
				(m_MouseX == Hot.m_MouseX)&&
				(m_MouseY == Hot.m_MouseY)); 
	}

	inline unsigned int Pack() const
	{
		unsigned int nPack;
		nPack = m_HotKey;
		nPack = nPack << 8;
		nPack = nPack | m_MouseButton;
		return nPack;
	}

	UINT m_HotKey;
	UINT m_MouseButton;
	LONG m_MouseX;
	LONG m_MouseY;

} D3DMOUSEKEY, *LPD3DMOUSEKEY;

typedef bool (*LPD3DHOTSPOTCALLBACK) (UINT,WPARAM,LPARAM);

typedef struct _D3DHOTSPOT
{
	_D3DHOTSPOT(LONG MinX = 0,LONG MaxX = 0,LONG MinY = 0,LONG MaxY = 0,LPD3DHOTSPOTCALLBACK HotCallback = 0,UINT HotKey = 0,UINT HotID = 0)
		:m_MinX(MinX),m_MaxX(MaxX),m_MinY(MinY),m_MaxY(MaxY),m_HotID(HotID),m_HotKey(HotKey),m_HotSpotCallback(HotCallback)
	{}

	UINT m_HotID;
	UINT m_HotKey;
	LONG m_MinX,m_MaxX;
	LONG m_MinY,m_MaxY;
	LPD3DHOTSPOTCALLBACK m_HotSpotCallback;

} D3DHOTSPOT,*LPD3DHOTSPOT;

typedef std::vector<D3DMOUSEKEY> D3DMOUSEKEYVECTOR;
typedef std::map<D3DMOUSEKEY,D3DHOTSPOT> D3DMOUSEHOTKEYMAP;

typedef struct _D3DKEY
{
	_D3DKEY(unsigned char ScanCode = 0, unsigned char HotKey = 0,ModifierState Modifier = MODIFIER_NONE) 
		: m_ScanCode(ScanCode), m_Modifier(Modifier),m_HotKey(HotKey)
	{}
	
	_D3DKEY & operator= (const _D3DKEY & Key)
	{
		m_Modifier  = Key.m_Modifier;
		m_ScanCode  = Key.m_ScanCode;
		m_HotKey = Key.m_HotKey;
		return *this;
	}

	inline bool	operator== (const _D3DKEY & That) const
	{ 
		return ((m_Modifier == That.m_Modifier) && 
				(m_ScanCode == That.m_ScanCode) &&
				(m_HotKey == That.m_HotKey) ); 
	}

	inline bool	operator< (const _D3DKEY & That) const
	{ 
		unsigned int First	 = Pack();
		unsigned int Second = That.Pack();
		return (First < Second); 
	}

	inline unsigned int Pack(void) const
	{
		unsigned int nPack;
		nPack = m_HotKey;
		nPack = nPack << 8;
		nPack = nPack | m_Modifier;
		nPack = nPack << 8;
		nPack = nPack | m_ScanCode;
		return nPack;
	}
	unsigned char					m_HotKey;
	unsigned char					m_ScanCode;
	ModifierState			        m_Modifier;
} D3DKEY, *LPD3DKEY;

typedef bool ( * LPD3DHOTKEYCALLBACK ) (UINT,WPARAM,LPARAM);

typedef struct _D3DHOTKEY
{
	_D3DHOTKEY(LPD3DHOTKEYCALLBACK HotKeyCallback = 0,UINT nHotKey = 0,UINT HotID = 0)
		:m_HotKey(nHotKey),m_HotKeyCallback(HotKeyCallback),m_HotID(HotID)
	{}
	UINT m_HotID;
	UINT m_HotKey;
	LPD3DHOTKEYCALLBACK m_HotKeyCallback;
} D3DHOTKEY,*LPD3DHOTKEY;

typedef std::vector<D3DKEY> D3DKEYVECTOR;
typedef std::map<D3DKEY,D3DHOTKEY> D3DKEYBOARDMAP;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -