Mercurial > pidgin
annotate src/win32/IdleTracker/idletrack.c @ 6218:d4fd13821925
[gaim-migrate @ 6704]
we should be releasing the man pages too, they're nifty.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 18 Jul 2003 15:08:31 +0000 |
parents | 5480a73b2696 |
children | 33ceba0dfd9b |
rev | line source |
---|---|
4533
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
1 /* |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
2 * idletrack.c |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
3 * |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
4 * Authors: mrgentry @ http://www.experts-exchange.com |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
5 * Herman Bloggs <hermanator12002@yahoo.com> |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
6 * Date: February, 2003 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
7 * Description: Track user inactivity. |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
8 */ |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
9 #include <windows.h> |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
10 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
11 #define EXPORT __declspec(dllexport) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
12 |
4548
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
13 /* from msdn docs */ |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
14 typedef struct tagMOUSEHOOKSTRUCT { |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
15 POINT pt; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
16 HWND hwnd; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
17 UINT wHitTestCode; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
18 DWORD dwExtraInfo; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
19 } MOUSEHOOKSTRUCT; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
20 |
4533
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
21 static HANDLE hMapObject = NULL; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
22 static DWORD *lastTime = NULL; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
23 static HHOOK keyHook = NULL; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
24 static HHOOK mouseHook = NULL; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
25 static HINSTANCE g_hInstance = NULL; |
4548
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
26 static POINT g_point; |
4533
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
27 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
28 static DWORD* setup_shared_mem() { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
29 BOOL fInit; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
30 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
31 // Set up the shared memory. |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
32 hMapObject = CreateFileMapping((HANDLE) 0xFFFFFFFF, // use paging file |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
33 NULL, // no security attributes |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
34 PAGE_READWRITE, // read/write access |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
35 0, // size: high 32-bits |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
36 sizeof(DWORD), // size: low 32-bits |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
37 "timermem"); // name of map object |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
38 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
39 if (hMapObject == NULL) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
40 return NULL; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
41 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
42 // The first process to attach initializes memory. |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
43 fInit = (GetLastError() != ERROR_ALREADY_EXISTS); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
44 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
45 // Get a pointer to the file-mapped shared memory. |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
46 lastTime = (DWORD*) MapViewOfFile(hMapObject, // object to map view of |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
47 FILE_MAP_WRITE, // read/write access |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
48 0, // high offset: map from |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
49 0, // low offset: beginning |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
50 0); // default: map entire file |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
51 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
52 if (lastTime == NULL) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
53 return NULL; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
54 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
55 *lastTime = GetTickCount(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
56 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
57 return lastTime; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
58 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
59 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
60 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
61 LRESULT CALLBACK KeyboardProc(int code, WPARAM wParam, LPARAM lParam) { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
62 if (code < 0) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
63 return CallNextHookEx(keyHook, code, wParam, lParam); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
64 if (lastTime == NULL) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
65 lastTime = setup_shared_mem(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
66 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
67 if (lastTime) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
68 *lastTime = GetTickCount(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
69 |
5336
5480a73b2696
[gaim-migrate @ 5712]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4548
diff
changeset
|
70 return CallNextHookEx(keyHook, code, wParam, lParam); |
4533
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
71 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
72 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
73 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
74 LRESULT CALLBACK MouseProc(int code, WPARAM wParam, LPARAM lParam) { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
75 if (code < 0) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
76 return CallNextHookEx(mouseHook, code, wParam, lParam); |
4548
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
77 |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
78 /* We need to verify that the Mouse pointer has actually moved. */ |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
79 if((g_point.x == ((MOUSEHOOKSTRUCT*)lParam)->pt.x) && |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
80 (g_point.y == ((MOUSEHOOKSTRUCT*)lParam)->pt.y)) |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
81 return 0; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
82 |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
83 g_point.x = ((MOUSEHOOKSTRUCT*)lParam)->pt.x; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
84 g_point.y = ((MOUSEHOOKSTRUCT*)lParam)->pt.y; |
4533
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
85 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
86 if (lastTime == NULL) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
87 lastTime = setup_shared_mem(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
88 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
89 if (lastTime) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
90 *lastTime = GetTickCount(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
91 |
5336
5480a73b2696
[gaim-migrate @ 5712]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4548
diff
changeset
|
92 return CallNextHookEx(mouseHook, code, wParam, lParam); |
4533
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
93 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
94 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
95 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
96 EXPORT DWORD wgaim_get_lastactive() { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
97 if (lastTime == NULL) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
98 lastTime = setup_shared_mem(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
99 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
100 if (lastTime) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
101 return *lastTime; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
102 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
103 return 0; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
104 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
105 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
106 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
107 EXPORT BOOL wgaim_set_idlehooks() { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
108 // Set up the shared memory. |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
109 lastTime = setup_shared_mem(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
110 if (lastTime == NULL) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
111 return FALSE; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
112 *lastTime = GetTickCount(); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
113 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
114 // Set up the keyboard hook. |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
115 keyHook = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc, g_hInstance, 0); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
116 if (keyHook == NULL) { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
117 UnmapViewOfFile(lastTime); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
118 CloseHandle(hMapObject); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
119 return FALSE; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
120 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
121 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
122 // Set up the mouse hook. |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
123 mouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc, g_hInstance, 0); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
124 if (mouseHook == NULL) { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
125 UnhookWindowsHookEx(keyHook); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
126 UnmapViewOfFile(lastTime); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
127 CloseHandle(hMapObject); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
128 return FALSE; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
129 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
130 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
131 return TRUE; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
132 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
133 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
134 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
135 EXPORT void wgaim_remove_idlehooks() { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
136 if (keyHook) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
137 UnhookWindowsHookEx(keyHook); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
138 if (mouseHook) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
139 UnhookWindowsHookEx(mouseHook); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
140 if (lastTime) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
141 UnmapViewOfFile(lastTime); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
142 if (hMapObject) |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
143 CloseHandle(hMapObject); |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
144 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
145 |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
146 int WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
147 switch(dwReason) { |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
148 case DLL_PROCESS_ATTACH: |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
149 g_hInstance = hInstance; |
4548
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
150 g_point.x = 0; |
ae85f27e4948
[gaim-migrate @ 4827]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
4533
diff
changeset
|
151 g_point.y = 0; |
4533
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
152 break; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
153 case DLL_PROCESS_DETACH: |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
154 break; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
155 } |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
156 return TRUE; |
516061abad03
[gaim-migrate @ 4812]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
diff
changeset
|
157 } |