Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Jun 5, 2018
1 parent 710a283 commit 8f2384e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Simplified JNA is a library that allows for the quick creation of mouse and keyb
JNA and JNA-platform must be imported into a project in order to use Simplified JNA. Currently only windows is supported.
#### Examples

In these samples, returing `false` allows the event to be parsed by the system. Chaning the return value to `true` will cancel the event.

> Keyboard Hook
```java
KeyEventReceiver keyHook = new KeyEventReceiver() {
@Override
public boolean onKeyRelease(boolean sys, KBDLLHOOKSTRUCT info) {
System.out.println("Key Released:" + info.vkCode);
return false;
}
@Override
public boolean onKeyPress(boolean sys, KBDLLHOOKSTRUCT info) {
System.out.println("Key Pressed:" + info.vkCode);
public boolean onKeyUpdate(SystemState sysState, PressState pressState, int time, int vkCode) {
System.out.println("Is pressed:" + (pressState == PressState.DOWN));
System.out.println("Alt down:" + (sysState == SystemState.SYSTEM));
System.out.println("Timestamp:" + time);
System.out.println("KeyCode:" + vkCode);
return false;
}
};
Expand All @@ -24,16 +24,16 @@ KeyHook.hook(keyHook);
```java
MouseEventReceiver mer = new MouseEventReceiver() {
@Override
public boolean onMousePress(MouseButtonType type, MOUSEHOOKSTRUCT info) {
public boolean boolean onMousePress(MouseButtonType type, HWND hwnd, POINT info) {
boolean isLeft = type == MouseButtonType.LEFT_DOWN;
if (isLeft) {
System.out.println("Left mouse button has been pressed!")
}
return false;
}
@Override public boolean onMouseRelease(MouseButtonType type, MOUSEHOOKSTRUCT info) { return false; }
@Override public boolean onMouseScroll(boolean down, MOUSEHOOKSTRUCT info) { return false; }
@Override public boolean onMouseMove(MOUSEHOOKSTRUCT info) { return false; }
@Override public boolean onMouseRelease(MouseButtonType type, HWND hwnd, POINT info) { return false; }
@Override public boolean onMouseScroll(boolean down, HWND hwnd, POINT info) { return false; }
@Override public boolean boolean onMouseMove(HWND hwnd, POINT info) { return false; }
};
MouseHook.hook(mer);
```

0 comments on commit 8f2384e

Please sign in to comment.