public abstract class AbstractHook
extends java.lang.Object
Concrete implementation of specific hook types will extend this class.
Modifier and Type | Field and Description |
---|---|
protected com.sun.jna.Pointer |
hhk |
protected int |
hookId |
protected java.lang.String |
hookname |
protected com.sun.jna.win32.StdCallLibrary.StdCallCallback |
hookProc |
protected boolean |
isHooked |
protected java.util.ArrayList<CallbackHookListener> |
listeners |
protected static User32 |
USER32INST |
static int |
WM_CHAR |
static int |
WM_KEYDOWN |
static int |
WM_KEYUP |
static int |
WM_KILLFOCUS |
static int |
WM_LBUTTONDBLCLK |
static int |
WM_LBUTTONDOWN |
static int |
WM_LBUTTONUP |
static int |
WM_MOUSEHOVER |
static int |
WM_MOUSEMOVE |
static int |
WM_RBUTTONDOWN |
static int |
WM_RBUTTONUP |
static int |
WM_SETFOCUS |
static int |
WM_SYSKEYDOWN |
static int |
WM_SYSKEYUP |
static int |
WM_UNICHAR |
Constructor and Description |
---|
AbstractHook(java.lang.String name) |
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.
|
com.sun.jna.Pointer |
getHook() |
boolean |
isHooked() |
boolean |
removeListener(CallbackHookListener listener)
remove a listener from the listener list
|
void |
run()
start the hook
|
protected void |
setHook(int id,
com.sun.jna.win32.StdCallLibrary.StdCallCallback proc)
set necessary information for a specific hook to be installed
|
void |
stop()
stop the hook
|
public static final int WM_LBUTTONDOWN
public static final int WM_LBUTTONUP
public static final int WM_LBUTTONDBLCLK
public static final int WM_RBUTTONDOWN
public static final int WM_RBUTTONUP
public static final int WM_MOUSEMOVE
public static final int WM_MOUSEHOVER
public static final int WM_KEYDOWN
public static final int WM_CHAR
public static final int WM_SETFOCUS
public static final int WM_KILLFOCUS
public static final int WM_KEYUP
public static final int WM_SYSKEYDOWN
public static final int WM_SYSKEYUP
public static final int WM_UNICHAR
protected java.lang.String hookname
protected com.sun.jna.Pointer hhk
protected boolean isHooked
protected int hookId
protected com.sun.jna.win32.StdCallLibrary.StdCallCallback hookProc
protected static User32 USER32INST
protected java.util.ArrayList<CallbackHookListener> listeners
public boolean addListener(CallbackHookListener listener)
listener
- -- a CallbackHookListenerpublic boolean removeListener(CallbackHookListener listener)
listener
- -- a CallbackHookListenerprotected void setHook(int id, com.sun.jna.win32.StdCallLibrary.StdCallCallback proc)
id
- -- the type of hookproc
- -- the callback procedure that should matched the first parameterpublic boolean isHooked()
public com.sun.jna.Pointer getHook()
public void run()
public void stop()
Copyright © SAS Institute. All Rights Reserved.