OSDN Git Service

first commit
[dokopop/dokopop.git] / DCHookTest / DCHookLoader.h
1 #ifndef __DCHookLoader_h
2 #define __DCHookLoader_h
3
4 #include <vector>
5 using namespace std;
6
7 enum eShortCutIndexes {
8         SCINX_AUTOSRCH_TOGGLE,
9         SCINX_AUTOSRCH_ON,
10         SCINX_AUTOSRCH_OFF,
11         SCINX_TOPMOST,
12         SCINX_TO_MAIN,
13         SCINX_QUICK_POPUP,
14         SCINX_POPUP_WINDOW,
15         SCINX_GROUP_CHANGE_1,
16         SCINX_GROUP_CHANGE_2,
17         SCINX_GROUP_CHANGE_3,
18         SCINX_GROUP_CHANGE_4,
19         SCINX_CBDSRCH,
20         SCINX_CLIPHISTORY,
21         SCINX_TAB_CHANGE_1,
22         SCINX_TAB_CHANGE_2,
23         SCINX_TAB_CHANGE_3,
24         SCINX_TAB_CHANGE_4,
25         SCINX_LAST,
26 };
27
28 #define SCINX_NOTIFY64  (0x1000)        // notify from 64bit HookDll
29
30 #include "HookDll.h"
31
32 class THookArray : public THookDllI {
33 protected:
34         typedef vector<THookDllI*> hook_vec;
35         vector<THookDllI*> Hooks;
36 public:
37         virtual ~THookArray();
38         void add(THookDllI*dll)
39         {
40                 Hooks.push_back(dll);
41         }
42         int size() const
43                 { return Hooks.size(); }
44         virtual bool Load(HWND hwnd);
45         virtual void Unload();
46
47         virtual bool Init(HWND hwnd);
48         void Init32(HWND hwnd);
49         virtual void Uninit();
50         virtual int Config( int clickonly, int keyaction, int keyflag );
51         virtual int Config2( struct TDCHConfig *cfg );
52         virtual int Capture();
53         virtual int CaptureAsync();
54         virtual int CaptureAsyncWait();
55         virtual int Debug();
56         virtual bool IsLoaded();
57         THookDllI &operator [](int i)
58                 { return *Hooks[i]; }
59 protected:
60         void clear();
61 };
62
63 class TDCHookLoader {
64 protected:
65         bool Use64;
66         bool EnableSendAllKeys;
67         THookArray Hooks;
68         class THookLoader64 *Hook64;    // reference pointer
69         class THookLoader *Hook32;              // reference pointer
70         bool LoadPending;
71         HWND hwndSavedParent;
72 public:
73         TDCHookLoader(bool use64);
74         bool LoadHook( HWND hwndParent );
75         void UnloadHook();
76         void Config( int clickonly, int keyaction, int keyflag );
77         void Config2( struct TDCHConfig *cfg );
78         void Capture();
79         void CaptureAsync();
80         void CaptureAsyncWait();
81
82         // for 64bit OS
83         void Notify64(LPARAM lParam);
84         bool IsReady() const
85                 { return !LoadPending; }
86
87         void Init32(HWND hwnd); // for debug
88 protected:
89         void LoadHookPost(HWND hwndParent);
90         int LoadKeyProfiles( );
91 };
92
93 extern ::TDCHookLoader shortcut;
94
95 #endif  // __DCHookLoader_h
96