- #ifndef WM_USER_INPUT_CHAR
- //输入板上的字符操作
- #define WM_USER_INPUT_CHAR (WM_USER+2)
- #endif
- #ifndef WM_USER_SCROLL_PAGE
- //进行翻页
- #define WM_USER_SCROLL_PAGE (WM_USER+4)
- #endif
- #define MAX_CHAR_NUM 77 //其它键最大数目
- #define MAX_SYMBOL_NUM 94 //西文字符数
- //#define VK_ESCAPE 0x1b
- #define VK_F1 0x70
- #define VK_F2 0x71
- #define VK_F3 0x72
- #define VK_F4 0x73
- #define VK_F5 0x74
- #define VK_F6 0x75
- #define VK_F7 0x76
- #define VK_F8 0x77
- #define VK_F9 0x78
- #define VK_F10 0x79
- //#define VK_F11 0x7a
- //#define VK_F12 0x7b
- //#define VK_SNAPSHOT 0x2c
- #define VK_PAUSE 0x13
- #define VK_BACK 0x08
- #define VK_TAB 0x09
- //#define VK_RETURN 0x0d
- #define VK_SPACE 0x20
- //#define VK_INSERT 0x2d
- //#define VK_DELETE 0x2e
- #define VK_HOME 0x24
- #define VK_END 0x23
- #define VK_PRIOR 0x21
- #define VK_NEXT 0x22
- #define VK_LEFT 0x25
- #define VK_UP 0x26
- #define VK_RIGHT 0x27
- #define VK_DOWN 0x28
- #define VK_0 '0'
- #define VK_1 '1'
- #define VK_2 '2'
- #define VK_3 '3'
- #define VK_4 '4'
- #define VK_5 '5'
- #define VK_6 '6'
- #define VK_7 '7'
- #define VK_8 '8'
- #define VK_9 '9'
- #define VK_A 'A'
- #define VK_B 'B'
- #define VK_C 'C'
- #define VK_D 'D'
- #define VK_E 'E'
- #define VK_F 'F'
- #define VK_G 'G'
- #define VK_H 'H'
- #define VK_I 'I'
- #define VK_J 'J'
- #define VK_K 'K'
- #define VK_L 'L'
- #define VK_M 'M'
- #define VK_N 'N'
- #define VK_O 'O'
- #define VK_P 'P'
- #define VK_Q 'Q'
- #define VK_R 'R'
- #define VK_S 'S'
- #define VK_T 'T'
- #define VK_U 'U'
- #define VK_V 'V'
- #define VK_W 'W'
- #define VK_X 'X'
- #define VK_Y 'Y'
- #define VK_Z 'Z'
- #define MAX_KEYS_NUM 256 //键盘键的数目
- //热键参数
- class CHotKeyParam
- {
- public:
- int m_nHotKeyNum ; //热键数目
- //热键内容
- BOOL m_bCtrl[MAX_HOT_KEY] ; //Ctrl键状态,0无,1有
- BOOL m_bAlt[MAX_HOT_KEY] ; //Alt键状态,0无,1有
- BOOL m_bShift[MAX_HOT_KEY] ; //Shift键状态,0无,1有
- int m_nChar[MAX_HOT_KEY] ; //其它键
- //其它键状态,0按下时有效,1弹起时有效
- BOOL m_bCharStatus[MAX_HOT_KEY] ;
- //判断该热键是否有效,1有效,0无效
- BOOL m_bEnable[MAX_HOT_KEY] ;
- FARPROC m_fpFunc[MAX_HOT_KEY] ; //与该热键关联的执行函数
- HHOOK m_hHookHandle ; //钩子句柄
- //按钮动作是否有效,1有效,0无效,初始为1
- BOOL m_bActionOk ;
- //标记按过那个热键,如果是-1,则没有按过
- int m_nHaveDoneKey ;
- //每个键的状态,0按下,1没有,初始为1
- BOOL m_bKeysStatus[MAX_KEYS_NUM] ;
- public:
- CHotKeyParam( void ) ;
- ~CHotKeyParam( void ) ;
- void SetEnableFlag( int n , BOOL b ) ;
- } ;
- //WH_GETMESSAGE 钩子函数对象
- class CGetMessageParam
- {
- public:
- HHOOK m_hHookHandle ; //钩子句柄
- HWND m_hFocusWnd ; //当前有输入焦点的窗口
- public:
- CGetMessageParam( void ) ;
- ~CGetMessageParam( void ) ;
- };
- #ifdef __cplusplus
- extern "C" {
- #endif
- //当按下某键时,判断是否有符合条件的热键
- BOOL JudgeKeysWhenDown( WPARAM wParam ) ;
- //当松开某键时,判断是否有符合条件的热键
- BOOL JudgeKeysWhenUp( WPARAM wParam ) ;
- //判断是否所有键的状态都符合要求
- BOOL AllKeysStatusIsOk( int n ) ;
- //热键钩子函数
- LRESULT CALLBACK HotKeyProc(
- int code , /* process-message flag */
- WPARAM wParam , /* virtual-key code */
- LPARAM lParam ) ; /* keyboard-message information */
- //指取翻译辅助键
- void AidFinger( void ) ;
- //输入法向后翻页
- void PageNext( void ) ;
- //输入法向前翻页
- void PagePrior( void ) ;
- //WH_GETMESSAGE钩子函数
- LRESULT __export CALLBACK GetMessageProc(
- int code , /* process-message flag */
- WPARAM wParam , /* undefined */
- LPARAM lParam ) ; /* pointer to MSG structure */
- #ifdef __cplusplus
- }
- #endif