public interface User32
extends com.sun.jna.win32.W32APIOptions, com.sun.jna.win32.StdCallLibrary
NativeWrapper
Modifier and Type | Interface and Description |
---|---|
static interface |
User32.CallWndProcCallBack
Callback function interface to CallWndProc for hook type WH_CALLWNDPROC
|
static class |
User32.CWPSTRUCT |
static interface |
User32.GetMsgProcCallBack
Callback function interface to GetMsgProc for hook type WH_GETMESSAGE
|
static class |
User32.KBDLLHOOKSTRUCT
define Hook structure about a low-level keyboard input event.
|
static interface |
User32.KeyBoardCallBack
Callback function interface to KeyboardProc for hook type WH_KEYBOARD
|
static interface |
User32.LLKeyBoardCallBack
Callback function interface to LowLevelKeyboardProc for hook type WH_KEYBOARD_LL
|
static interface |
User32.LLMouseCallBack
Callback function interface to LowLevelMouseProc for hook type WH_MOUSE_LL
|
static interface |
User32.MouseCallBack
Callback function interface to MouseProc for hook type WH_MOUSE
|
static class |
User32.MOUSEHOOKSTRUCT
Refer to MSDN:
Contains information about a mouse event passed to a WH_MOUSE hook procedure
typedef struct tagMOUSEHOOKSTRUCT {
POINT pt;
HWND hwnd;
UINT wHitTestCode;
ULONG_PTR dwExtraInfo;
} MOUSEHOOKSTRUCT, *PMOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT;
|
static class |
User32.MSG
typedef struct tagMSG {
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG
|
static class |
User32.MSLLHOOKSTRUCT
Contains information about a low-level mouse input event.
|
static class |
User32.POINT
typedef struct tagPOINT {
LONG x;
LONG y;
} POINT, *PPOINT;
|
static interface |
User32.WNDENUMPROC
Callback Function used for User32 EnumWindows
|
Modifier and Type | Field and Description |
---|---|
static User32 |
INSTANCE |
static int |
SW_SHOW |
ASCII_OPTIONS, DEFAULT_OPTIONS, UNICODE_OPTIONS
Modifier and Type | Method and Description |
---|---|
com.sun.jna.Pointer |
CallNextHookEx(com.sun.jna.Pointer hhk,
int nCode,
com.sun.jna.NativeLong wParam,
com.sun.jna.Pointer lParam)
Refer to MSDN:
LRESULT WINAPI CallNextHookEx(_in_opt HHOOK hhk, _in int nCode, _in WPARAM wParam, _in LPARAM lParam);
|
com.sun.jna.Pointer |
DispatchMessageA(User32.MSG msg)
Dispatches a message to a window procedure.
|
boolean |
EnumChildWindows(com.sun.jna.NativeLong parent,
User32.WNDENUMPROC lpEnumFunc,
com.sun.jna.Pointer arg)
The EnumChildWindows function enumerates all child windows of the parent window
by passing the handle to each child window, in turn, to an application-defined
callback function.
|
boolean |
EnumWindows(User32.WNDENUMPROC lpEnumFunc,
com.sun.jna.Pointer arg)
The EnumWindows function enumerates all top-level windows on the screen
by passing the handle to each window, in turn, to an application-defined
callback function.
|
com.sun.jna.NativeLong |
GetDesktopWindow()
HWND GetDesktopWindow(VOID)
The GetDesktopWindow function returns a handle to the main Desktop window
(the window on which all other windows are painted).
|
com.sun.jna.NativeLong |
GetForegroundWindow()
HWND GetForegroundWindow(VOID)
The GetForegroundWindow function returns a handle to the foreground window
(the window with which the user is currently working).
|
int |
GetGuiResources(com.sun.jna.Pointer hProcess,
int uiFlags)
DWORD WINAPI GetGuiResources(_in HANDLE hProcess, _in DWORD uiFlags);
|
short |
GetKeyState(int vkcode)
SHORT WINAPI GetKeyState(__in int nVirtKey)
|
com.sun.jna.NativeLong |
GetMenu(com.sun.jna.NativeLong hWnd) |
int |
GetMenuItemCount(com.sun.jna.NativeLong hMenu) |
int |
GetMenuItemID(com.sun.jna.NativeLong hMenu,
int nPos) |
int |
GetMenuState(com.sun.jna.NativeLong hMenu,
int uId,
int uFlags) |
int |
GetMenuStringW(com.sun.jna.NativeLong hMenu,
int uIDItem,
com.sun.jna.Pointer lpString,
int nMaxCount,
int uFlag) |
int |
GetMessageA(User32.MSG pMsg,
com.sun.jna.NativeLong hwnd,
int wMsgFilterMin,
int wMsgFilterMax)
Refer to MSDN:
BOOL WINAPI GetMessage(__out LPMSG lpMsg,__in_opt HWND hWnd, __in UINT wMsgFilterMin, __in UINT wMsgFilterMax);
|
com.sun.jna.NativeLong |
GetSubMenu(com.sun.jna.NativeLong hMenu,
int nPos) |
int |
GetWindowTextA(com.sun.jna.NativeLong hWnd,
byte[] lpString,
int nMaxCount)
int WINAPI GetWindowText(
__in HWND hWnd,
__out LPTSTR lpString,
__in int nMaxCount
);
|
int |
GetWindowTextA(com.sun.jna.NativeLong hWnd,
com.sun.jna.Pointer lpString,
int nMaxCount)
int WINAPI GetWindowText(
__in HWND hWnd,
__out LPTSTR lpString,
__in int nMaxCount
);
|
int |
GetWindowThreadProcessId(com.sun.jna.NativeLong hWnd,
com.sun.jna.Pointer pidOut)
The GetWindowThreadProcessId function retrieves the identifier of the thread that
created the specified window and, optionally, the identifier of the process that
created the window.
|
boolean |
IsMenu(com.sun.jna.NativeLong hMenu) |
boolean |
IsWindow(com.sun.jna.NativeLong hWnd) |
boolean |
SetForegroundWindow(com.sun.jna.NativeLong hWnd)
Bring the window to front
|
com.sun.jna.Pointer |
SetWindowsHookExA(int idHook,
com.sun.jna.win32.StdCallLibrary.StdCallCallback lpfn,
com.sun.jna.Pointer hMod,
int dwThreadId)
Refer to MSDN:
HHOOK WINAPI SetWindowsHookEx(__in int idHook,__ *in HOOKPROC lpfn,__in HINSTANCE hMod,__in DWORD dwThreadId);
|
com.sun.jna.Pointer |
SetWindowsHookExW(int idHook,
com.sun.jna.win32.StdCallLibrary.StdCallCallback lpfn,
com.sun.jna.Pointer hMod,
int dwThreadId) |
boolean |
ShowWindow(com.sun.jna.NativeLong hWnd,
int nCmdShow)
Bring the window to focus
|
boolean |
TranslateMessage(User32.MSG msg)
Translates virtual-key messages into character messages.
|
boolean |
UnhookWindowsHookEx(com.sun.jna.Pointer hProcess)
Refer to MSDN: BOOL WINAPI UnhookWindowsHookEx(__in HHOOK hhk)
|
static final User32 INSTANCE
static final int SW_SHOW
com.sun.jna.NativeLong GetForegroundWindow()
The user should not normally call this method directly, but should try to call the NativeWrapper library instead.
NativeWrapper.GetForegroundWindow()
boolean ShowWindow(com.sun.jna.NativeLong hWnd, int nCmdShow)
hWnd
- nCmdShow
- NativeWrapper.SetForegroundWindow(String)
boolean SetForegroundWindow(com.sun.jna.NativeLong hWnd)
hWnd
- com.sun.jna.NativeLong GetDesktopWindow()
The user should not normally call this method directly, but should try to call the NativeWrapper library instead.
NativeWrapper.GetDesktopWindow()
boolean EnumWindows(User32.WNDENUMPROC lpEnumFunc, com.sun.jna.Pointer arg)
lpEnumFunc
- instance of callback function WNDENUMPROCarg
- boolean EnumChildWindows(com.sun.jna.NativeLong parent, User32.WNDENUMPROC lpEnumFunc, com.sun.jna.Pointer arg)
Handle
- to parent windowlpEnumFunc
- instance of callback function WNDENUMPROCarg
- int GetWindowThreadProcessId(com.sun.jna.NativeLong hWnd, com.sun.jna.Pointer pidOut)
hWnd
- -- [in] Handle to the window.pidOut
- -- [out] Pointer to a variable that receives the process identifier.
If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of
the process to the variable; otherwise, it does not.int GetGuiResources(com.sun.jna.Pointer hProcess, int uiFlags)
Retrieves the count of handles of GUI objects used by the specified process.
We usually want to get USER objects. These are: Accelerator table -- Keyboard Accelerators, Caret -- Carets, Cursor -- Cursors, DDE conversation -- Dynamic Data Exchange Management Library, Hook -- Hooks, Icon -- Icons, Menu -- Menus, Window -- Windows, Window position -- Windows.
GDI objects: Bitmap -- Bitmaps, Brush -- Brushes, DC -- Device Contexts, Enhanced metafile -- Metafiles, Enhanced-metafile DC -- Metafiles, Font -- Fonts and Text, Memory DC -- Device Contexts, Metafile -- Metafiles, Metafile DC -- Metafiles, Palette -- Colors, Pen and extended pen -- Pens, Region -- Regions.
hProcess
- - HANDLE received from OpenProcessuiFlags
- -- 0= get count of GDI objects. 1=count of USER objects.com.sun.jna.Pointer SetWindowsHookExA(int idHook, com.sun.jna.win32.StdCallLibrary.StdCallCallback lpfn, com.sun.jna.Pointer hMod, int dwThreadId)
Installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the same desktop as the calling thread.
idHook
- -- the type of hook procedure to be installed.lpfn
- -- a pointer to the hook procedure.hMod
- -- a handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter
must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and
if the hook procedure is within the code associated with the current process.dwThreadId
- -- the identifier of the thread with which the hook procedure is to be associated. If this
parameter is zero, the hook procedure is associated with all existing threads running in the
same desktop as the calling thread.com.sun.jna.Pointer SetWindowsHookExW(int idHook, com.sun.jna.win32.StdCallLibrary.StdCallCallback lpfn, com.sun.jna.Pointer hMod, int dwThreadId)
boolean UnhookWindowsHookEx(com.sun.jna.Pointer hProcess)
Removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.
hProcess
- -- A handle to the hook to be removed. This parameter is a hook handle obtained by a
previous call to SetWindowsHookEx.com.sun.jna.Pointer CallNextHookEx(com.sun.jna.Pointer hhk, int nCode, com.sun.jna.NativeLong wParam, com.sun.jna.Pointer lParam)
Passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this function either before or after processing the hook information
hhk
- -- optional, this parameter is ignored.nCode
- -- hook code,next hook procedure uses this code to determine how to process the hook information.wParam
- -- the wParam value, its meaning depends on the type of hook associated with the current hook chain.lParam
- -- the lParam value, its meaning depends on the type of hook associated with the current hook chain.int GetMessageA(User32.MSG pMsg, com.sun.jna.NativeLong hwnd, int wMsgFilterMin, int wMsgFilterMax)
Retrieves a message from the calling thread's message queue. The function dispatches incoming sent messages until a posted message is available for retrieval.
pMsg
- -- A pointer to an MSG structure that receives message information from the thread's message queue.hwnd
- -- A handle to the window whose messages are to be retrieved. The window must belong to the current thread.
If this value is NULL, this method obtains messages for any window that belongs to the calling thread.wMsgFilterMin
- -- the lowest message value obtained.wMsgFilterMax
- -- the lowest message value obtained.
If wMsgFilterMin and wMsgFilterMax are both zero, this method returns all available messages;
that is, no range filtering is performed.boolean TranslateMessage(User32.MSG msg)
msg
- -- A pointer to an MSG structure that contains message information retrieved from the calling
thread's message queue by using the GetMessage or PeekMessage function.com.sun.jna.Pointer DispatchMessageA(User32.MSG msg)
msg
- -- A pointer to a structure that contains the message.short GetKeyState(int vkcode)
Retrieves the status of the specified virtual key. The status specifies whether the key is up, down, or toggled (on, off-alternating each time the key is pressed.
vkcode
- -- A virtual key.int GetWindowTextA(com.sun.jna.NativeLong hWnd, com.sun.jna.Pointer lpString, int nMaxCount)
int GetWindowTextA(com.sun.jna.NativeLong hWnd, byte[] lpString, int nMaxCount)
com.sun.jna.NativeLong GetMenu(com.sun.jna.NativeLong hWnd)
hWnd
- A handle to the window whose menu handle is to be retrieved.boolean IsMenu(com.sun.jna.NativeLong hMenu)
hMenu
- A handle to be tested.int GetMenuItemCount(com.sun.jna.NativeLong hMenu)
hMenu
- A handle to the menu to be examinedint GetMenuStringW(com.sun.jna.NativeLong hMenu, int uIDItem, com.sun.jna.Pointer lpString, int nMaxCount, int uFlag)
hMenu
- A handle to the menuuIDItem
- The menu item to be changed, as determined by the uFlag parameterlpString
- The buffer that receives the null-terminated string. If the string is as long or longer than lpString,
the string is truncated and the terminating null character is added.
If lpString is NULL, the function returns the length of the menu stringnMaxCount
- The maximum length, in characters, of the string to be copied. If the string is longer than the maximum
specified in the nMaxCount parameter, the extra characters are truncated.
If nMaxCount is 0, the function returns the length of the menu stringuFlag
- Indicates how the uId parameter is interpreted. This parameter can be one of the following values
MF_BYCOMMAND (0x00000000L) ; MF_BYPOSITION (0x00000400L)int GetMenuItemID(com.sun.jna.NativeLong hMenu, int nPos)
hMenu
- A handle to the menu that contains the item whose identifier is to be retrievednPos
- The zero-based relative position of the menu item whose identifier is to be retrievedint GetMenuState(com.sun.jna.NativeLong hMenu, int uId, int uFlags)
hMenu
- A handle to the menu that contains the menu item whose flags are to be retrieveduId
- The menu item for which the menu flags are to be retrieved, as determined by the uFlags parameteruFlags
- Indicates how the uId parameter is interpreted. This parameter can be one of the following values
MF_BYCOMMAND (0x00000000L) ; MF_BYPOSITION (0x00000400L)com.sun.jna.NativeLong GetSubMenu(com.sun.jna.NativeLong hMenu, int nPos)
hMenu
- A handle to the menunPos
- The zero-based relative position in the specified menu of an item that activates a drop-down menu or submenuboolean IsWindow(com.sun.jna.NativeLong hWnd)
hWnd
- A handle to the window to be testedCopyright © SAS Institute. All Rights Reserved.