public class MouseHook extends AbstractHook
Usage:
1) define a class that implements interface MouseHookListener
2) to intercept mouse events in the class, implement: public void onMouseHook(int nCode, NativeLong wParam, MOUSEHOOKSTRUCT info)
3) use MouseHook in the class
org.safs.natives.test.hookTest
Modifier and Type | Field and Description |
---|---|
static int |
WH_MOUSE
the type of hook for a hook procedure that monitors mouse events
|
hhk, hookId, hookname, hookProc, isHooked, listeners, USER32INST, WM_CHAR, WM_KEYDOWN, WM_KEYUP, WM_KILLFOCUS, WM_LBUTTONDBLCLK, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MOUSEHOVER, WM_MOUSEMOVE, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETFOCUS, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_UNICHAR
Constructor and Description |
---|
MouseHook() |
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(CallbackHookListener listener)
add a listener for current Hook, it should be overridden in its derived classes for setting a specific listener.
|
void |
run()
start the hook
|
void |
stop()
stop the hook
|
getHook, isHooked, removeListener, setHook
public static final int WH_MOUSE
public boolean addListener(CallbackHookListener listener)
AbstractHook
addListener
in class AbstractHook
listener
- -- a CallbackHookListenerpublic void stop()
AbstractHook
stop
in class AbstractHook
public void run()
AbstractHook
run
in class AbstractHook
Copyright © SAS Institute. All Rights Reserved.