diff --git a/README.md b/README.md
index 7c65eb6..85c9bc7 100644
--- a/README.md
+++ b/README.md
@@ -136,7 +136,7 @@ You can include `system-hook` as a dependency from Maven Central by adding it to
lc.kra.system
system-hook
- 3.7
+ 3.8
```
diff --git a/appveyor.yml b/appveyor.yml
index 43f645b..07edbe4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: 3.7.{build}
+version: 3.8.{build}
branches:
only:
diff --git a/pom.xml b/pom.xml
index 085f9c5..bc1a7af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
lc.kra.system
system-hook
- 3.7
+ 3.8
Java System Hook
Global Keyboard / Mouse Hook for Java applications.
diff --git a/src/main/native/windows/SystemHook.c b/src/main/native/windows/SystemHook.c
index 1ef7512..7549a4f 100644
--- a/src/main/native/windows/SystemHook.c
+++ b/src/main/native/windows/SystemHook.c
@@ -216,7 +216,6 @@ LRESULT CALLBACK WndProc(HWND hWndMain, UINT uMsg, WPARAM wParam, LPARAM lParam)
UINT event = raw->data.keyboard.Message;
USHORT vkCode = raw->data.keyboard.VKey,
scanCode = raw->data.keyboard.MakeCode;
- free(lpb); // free this now to save memory
handleKey("WndProc", event, vkCode, scanCode, hDevice);
@@ -225,7 +224,6 @@ LRESULT CALLBACK WndProc(HWND hWndMain, UINT uMsg, WPARAM wParam, LPARAM lParam)
case RIM_TYPEMOUSE: {
LONG lLastX = raw->data.mouse.lLastX, lLastY = raw->data.mouse.lLastY;
USHORT buttonFlags = raw->data.mouse.usButtonFlags, buttonData = raw->data.mouse.usButtonData;
- free(lpb); // free this now to save memory
JNIEnv* env;
if((*jvm)->AttachCurrentThread(jvm, (void**)&env, NULL)>=JNI_OK) {
@@ -267,11 +265,25 @@ LRESULT CALLBACK WndProc(HWND hWndMain, UINT uMsg, WPARAM wParam, LPARAM lParam)
break;
}
}
+
+ DefRawInputProc(&raw, 1, sizeof(RAWINPUTHEADER));
+ free(lpb); // free this now to save memory
+
break;
}
- case WM_CLOSE:
+ case WM_CLOSE: {
+ // determine the hook window (by the hWndMain)
+ size_t hook = SHRT_MAX; for(size_t ridIdx=0;ridIdx