Class User32
- java.lang.Object
-
- org.lwjgl.system.windows.User32
-
public class User32 extends java.lang.Object
Native bindings to WinUser.h and user32.dll.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
User32.Functions
Contains the function pointers loaded from the user32SharedLibrary
.
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static boolean
AdjustWindowRectEx(RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle)
Calculates the required size of the window rectangle, based on the desired size of the client rectangle.static boolean
BringWindowToTop(long hWnd)
Brings the specified window to the top of the Z order.static int
ChangeDisplaySettingsEx(java.nio.ByteBuffer lpszDeviceName, DEVMODE lpDevMode, long hwnd, int dwflags, long lParam)
Changes the settings of the specified display device to the specified graphics mode.static int
ChangeDisplaySettingsEx(java.lang.CharSequence lpszDeviceName, DEVMODE lpDevMode, long hwnd, int dwflags, long lParam)
Changes the settings of the specified display device to the specified graphics mode.static boolean
ClipCursor(RECT rect)
Confines the cursor to a rectangular area on the screen.static boolean
CloseTouchInputHandle(long hTouchInput)
Closes a touch input handle, frees process memory associated with it, and invalidates the handle.static long
CreateWindowEx(int dwExStyle, java.nio.ByteBuffer lpClassName, java.nio.ByteBuffer lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, long hWndParent, long hMenu, long hInstance, long lpParam)
Creates an overlapped, pop-up, or child window with an extended window style; otherwise, this function is identical to the CreateWindow function.static long
CreateWindowEx(int dwExStyle, java.lang.CharSequence lpClassName, java.lang.CharSequence lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, long hWndParent, long hMenu, long hInstance, long lpParam)
Creates an overlapped, pop-up, or child window with an extended window style; otherwise, this function is identical to the CreateWindow function.static long
DefWindowProc(long hWnd, int Msg, long wParam, long lParam)
Calls the default window procedure to provide default processing for any window messages that an application does not process.static boolean
DestroyWindow(long hWnd)
Destroys the specified window.static long
DispatchMessage(MSG lpmsg)
Dispatches a message to a window procedure.static boolean
EnumDisplayDevices(java.nio.ByteBuffer lpDevice, int iDevNum, DISPLAY_DEVICE lpDisplayDevice, int dwFlags)
Obtains information about the display devices in the current session.static boolean
EnumDisplayDevices(java.lang.CharSequence lpDevice, int iDevNum, DISPLAY_DEVICE lpDisplayDevice, int dwFlags)
Obtains information about the display devices in the current session.static boolean
EnumDisplaySettingsEx(java.nio.ByteBuffer lpszDeviceName, int iModeNum, DEVMODE lpDevMode, int dwFlags)
Retrieves information about one of the graphics modes for a display device.static boolean
EnumDisplaySettingsEx(java.lang.CharSequence lpszDeviceName, int iModeNum, DEVMODE lpDevMode, int dwFlags)
Retrieves information about one of the graphics modes for a display device.static long
GetClassLongPtr(long hWnd, int nIndex)
Retrieves the specified value from theWNDCLASSEX
structure associated with the specified window.static boolean
GetCursorPos(POINT point)
Retrieves the position of the mouse cursor, in screen coordinates.static long
GetDC(long hWnd)
Retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen.static SharedLibrary
getLibrary()
Returns the user32SharedLibrary
.static boolean
GetMessage(MSG lpMsg, long hWnd, int wMsgFilterMin, int wMsgFilterMax)
Retrieves a message from the calling thread's message queue.static boolean
GetMonitorInfo(long hMonitor, MONITORINFOEX lpmi)
Retrieves information about a display monitor.static int
GetSystemMetrics(int index)
Retrieves the specified system metric or system configuration setting.static boolean
GetTouchInputInfo(long hTouchInput, TOUCHINPUT.Buffer pInputs, int cbSize)
Retrieves detailed information about touch inputs associated with a particular touch input handle.static long
GetWindowLongPtr(long hWnd, int nIndex)
Retrieves information about the specified window.static boolean
GetWindowPlacement(long hWnd, WINDOWPLACEMENT lpwndpl)
Retrieves the show state and the restored, minimized, and maximized positions of the specified window.static boolean
GetWindowRect(long hWnd, RECT lpRect)
Retrieves the dimensions of the bounding rectangle of the specified window.static boolean
IsIconic(long hWnd)
Determines whether the specified window is minimized (iconic).static boolean
IsTouchWindow(long hWnd, int[] pulFlags)
Array version of:User32.IsTouchWindow(long, java.nio.IntBuffer)
static boolean
IsTouchWindow(long hWnd, java.nio.IntBuffer pulFlags)
Checks whether a specified window is touch-capable and, optionally, retrieves the modifier flags set for the window's touch capability.static boolean
IsWindowVisible(long hWnd)
Determines the visibility state of the specified window.static boolean
IsZoomed(long hWnd)
Determines whether a window is maximized.static long
LoadCursor(long instance, java.nio.ByteBuffer cursorName)
Loads the specified cursor resource from the executable (.EXE) file associated with an application instance.static long
LoadCursor(long instance, java.lang.CharSequence cursorName)
Loads the specified cursor resource from the executable (.EXE) file associated with an application instance.static long
LoadIcon(long instance, java.nio.ByteBuffer iconName)
Loads the specified icon resource from the executable (.exe) file associated with an application instance.static long
LoadIcon(long instance, java.lang.CharSequence iconName)
Loads the specified icon resource from the executable (.exe) file associated with an application instance.static long
MonitorFromWindow(long hWnd, int dwFlags)
Retrieves a handle to the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.static boolean
MoveWindow(long hWnd, int X, int Y, int nWidth, int nHeight, boolean bRepaint)
Changes the position and dimensions of the specified window.static long
nCreateWindowExW(long __functionAddress, int dwExStyle, long lpClassName, long lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, long hWndParent, long hMenu, long hInstance, long lpParam)
static int
nGetMessageW(long __functionAddress, long lpMsg, long hWnd, int wMsgFilterMin, int wMsgFilterMax)
Unsafe version of:User32.GetMessage(org.lwjgl.system.windows.MSG, long, int, int)
static long
nLoadCursorW(long __functionAddress, long instance, long cursorName)
Unsafe version of:User32.LoadCursor(long, java.nio.ByteBuffer)
static long
nLoadIconW(long __functionAddress, long instance, long iconName)
Unsafe version of:User32.LoadIcon(long, java.nio.ByteBuffer)
static int
nPostMessageW(long __functionAddress, long hWnd, int Msg, long wParam, long lParam)
Unsafe version of:User32.PostMessage(long, int, long, long)
static short
nRegisterClassExW(long __functionAddress, long lpwcx)
Unsafe version of:User32.RegisterClassEx(org.lwjgl.system.windows.WNDCLASSEX)
static int
nSendMessageW(long __functionAddress, long hWnd, int Msg, long wParam, long lParam)
Unsafe version of:User32.SendMessage(long, int, long, long)
static int
nSetWindowTextW(long __functionAddress, long hWnd, long lpString)
Unsafe version of:User32.SetWindowText(long, java.nio.ByteBuffer)
static int
nUnregisterClassW(long __functionAddress, long lpClassName, long hInstance)
Unsafe version of:User32.UnregisterClass(java.nio.ByteBuffer, long)
static boolean
PeekMessage(MSG lpMsg, long hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg)
Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist).static boolean
PostMessage(long hWnd, int Msg, long wParam, long lParam)
Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.static short
RegisterClassEx(WNDCLASSEX lpwcx)
Registers a window class for subsequent use in calls to theUser32.CreateWindowEx(int, java.nio.ByteBuffer, java.nio.ByteBuffer, int, int, int, int, int, long, long, long, long)
function.static boolean
RegisterTouchWindow(long hWnd, int ulFlags)
Registers a window as being touch-capable.static boolean
ReleaseDC(long hWnd, long hDC)
Releases a device context (DC), freeing it for use by other applications.static boolean
SendMessage(long hWnd, int Msg, long wParam, long lParam)
Sends the specified message to a window or windows.static long
SetClassLongPtr(long hWnd, int nIndex, long dwNewLong)
Replaces the specified value at the specified offset in the extra class memory or theWNDCLASSEX
structure for the class to which the specified window belongs.static long
SetCursor(long hCursor)
Sets the cursor shape.static boolean
SetCursorPos(int X, int Y)
Moves the cursor to the specified screen coordinates.static boolean
SetLayeredWindowAttributes(long hwnd, int crKey, byte bAlpha, int dwFlags)
static long
SetWindowLongPtr(long hWnd, int nIndex, long dwNewLong)
Changes an attribute of the specified window.static boolean
SetWindowPlacement(long hWnd, WINDOWPLACEMENT lpwndpl)
Sets the show state and the restored, minimized, and maximized positions of the specified window.static boolean
SetWindowPos(long hWnd, long hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags)
Changes the size, position, and Z order of a child, pop-up, or top-level window.static boolean
SetWindowText(long hWnd, java.nio.ByteBuffer lpString)
Changes the text of the specified window's title bar (if it has one).static boolean
SetWindowText(long hWnd, java.lang.CharSequence lpString)
Changes the text of the specified window's title bar (if it has one).static int
ShowCursor(boolean show)
Displays or hides the cursor.static boolean
ShowWindow(long hWnd, int nCmdShow)
Sets the specified window's show state.static boolean
TranslateMessage(MSG lpMsg)
Translates virtual-key messages into character messages.static boolean
UnregisterClass(java.nio.ByteBuffer lpClassName, long hInstance)
Unregisters a window class, freeing the memory required for the class.static boolean
UnregisterClass(java.lang.CharSequence lpClassName, long hInstance)
Unregisters a window class, freeing the memory required for the class.static boolean
UnregisterTouchWindow(long hWnd)
Registers a window as no longer being touch-capable.static boolean
UpdateWindow(long hWnd)
Updates the client area of the specified window by sending aUser32.WM_PAINT
message to the window if the window's update region is not empty.static boolean
WaitMessage()
Yields control to other threads when a thread has no other messages in its message queue.
-
-
-
Field Detail
-
WS_OVERLAPPED, WS_POPUP, WS_CHILD, WS_MINIMIZE, WS_VISIBLE, WS_DISABLED, WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_MAXIMIZE, WS_CAPTION, WS_BORDER, WS_DLGFRAME, WS_VSCROLL, WS_HSCROLL, WS_SYSMENU, WS_THICKFRAME, WS_GROUP, WS_TABSTOP, WS_MINIMIZEBOX, WS_MAXIMIZEBOX, WS_OVERLAPPEDWINDOW, WS_POPUPWINDOW, WS_CHILDWINDOW, WS_TILED, WS_ICONIC, WS_SIZEBOX, WS_TILEDWINDOW
Window Styles
-
WS_EX_DLGMODALFRAME, WS_EX_NOPARENTNOTIFY, WS_EX_TOPMOST, WS_EX_ACCEPTFILES, WS_EX_TRANSPARENT, WS_EX_MDICHILD, WS_EX_TOOLWINDOW, WS_EX_WINDOWEDGE, WS_EX_CLIENTEDGE, WS_EX_CONTEXTHELP, WS_EX_RIGHT, WS_EX_LEFT, WS_EX_RTLREADING, WS_EX_LTRREADING, WS_EX_LEFTSCROLLBAR, WS_EX_RIGHTSCROLLBAR, WS_EX_CONTROLPARENT, WS_EX_STATICEDGE, WS_EX_APPWINDOW, WS_EX_OVERLAPPEDWINDOW, WS_EX_PALETTEWINDOW, WS_EX_LAYERED, WS_EX_NOINHERITLAYOUT, WS_EX_LAYOUTRTL, WS_EX_COMPOSITED, WS_EX_NOACTIVATE
Extended Window Styles
-
CW_USEDEFAULT
May be used inUser32.CreateWindowEx(int, java.nio.ByteBuffer, java.nio.ByteBuffer, int, int, int, int, int, long, long, long, long)
for the x, y, width, height parameters.
-
CS_VREDRAW, CS_HREDRAW, CS_DBLCLKS, CS_OWNDC, CS_CLASSDC, CS_PARENTDC, CS_NOCLOSE, CS_SAVEBITS, CS_BYTEALIGNCLIENT, CS_BYTEALIGNWINDOW, CS_GLOBALCLASS, CS_IME, CS_DROPSHADOW
Class styles
-
WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_SIZE, WM_ACTIVATE, WM_SETFOCUS, WM_KILLFOCUS, WM_ENABLE, WM_SETREDRAW, WM_SETTEXT, WM_GETTEXT, WM_GETTEXTLENGTH, WM_PAINT, WM_CLOSE, WM_QUERYENDSESSION, WM_QUERYOPEN, WM_ENDSESSION, WM_QUIT, WM_ERASEBKGND, WM_SYSCOLORCHANGE, WM_SHOWWINDOW, WM_WININICHANGE, WM_SETTINGCHANGE, WM_DEVMODECHANGE, WM_ACTIVATEAPP, WM_FONTCHANGE, WM_TIMECHANGE, WM_CANCELMODE, WM_SETCURSOR, WM_MOUSEACTIVATE, WM_CHILDACTIVATE, WM_QUEUESYNC, WM_GETMINMAXINFO, WM_PAINTICON, WM_ICONERASEBKGND, WM_NEXTDLGCTL, WM_SPOOLERSTATUS, WM_DRAWITEM, WM_MEASUREITEM, WM_DELETEITEM, WM_VKEYTOITEM, WM_CHARTOITEM, WM_SETFONT, WM_GETFONT, WM_SETHOTKEY, WM_GETHOTKEY, WM_QUERYDRAGICON, WM_COMPAREITEM, WM_GETOBJECT, WM_COMPACTING, WM_COMMNOTIFY, WM_WINDOWPOSCHANGING, WM_WINDOWPOSCHANGED, WM_POWER, WM_COPYDATA, WM_CANCELJOURNAL, WM_NOTIFY, WM_INPUTLANGCHANGEREQUEST, WM_INPUTLANGCHANGE, WM_TCARD, WM_HELP, WM_USERCHANGED, WM_NOTIFYFORMAT, WM_CONTEXTMENU, WM_STYLECHANGING, WM_STYLECHANGED, WM_DISPLAYCHANGE, WM_GETICON, WM_SETICON, WM_NCCREATE, WM_NCDESTROY, WM_NCCALCSIZE, WM_NCHITTEST, WM_NCPAINT, WM_NCACTIVATE, WM_GETDLGCODE, WM_SYNCPAINT, WM_NCMOUSEMOVE, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_NCLBUTTONDBLCLK, WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_NCRBUTTONDBLCLK, WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_NCMBUTTONDBLCLK, WM_NCXBUTTONDOWN, WM_NCXBUTTONUP, WM_NCXBUTTONDBLCLK, WM_INPUT_DEVICE_CHANGE, WM_INPUT, WM_KEYFIRST, WM_KEYDOWN, WM_KEYUP, WM_CHAR, WM_DEADCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_SYSCHAR, WM_SYSDEADCHAR, WM_UNICHAR, UNICODE_NOCHAR, WM_IME_STARTCOMPOSITION, WM_IME_ENDCOMPOSITION, WM_IME_COMPOSITION, WM_IME_KEYLAST, WM_INITDIALOG, WM_COMMAND, WM_SYSCOMMAND, WM_TIMER, WM_HSCROLL, WM_VSCROLL, WM_INITMENU, WM_INITMENUPOPUP, WM_GESTURE, WM_GESTURENOTIFY, WM_MENUSELECT, WM_MENUCHAR, WM_ENTERIDLE, WM_MENURBUTTONUP, WM_MENUDRAG, WM_MENUGETOBJECT, WM_UNINITMENUPOPUP, WM_MENUCOMMAND, WM_CHANGEUISTATE, WM_UPDATEUISTATE, WM_QUERYUISTATE, WM_CTLCOLORMSGBOX, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC, MN_GETHMENU, WM_MOUSEFIRST, WM_MOUSEMOVE, WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, WM_MOUSEWHEEL, WM_XBUTTONDOWN, WM_XBUTTONUP, WM_XBUTTONDBLCLK, WM_MOUSEHWHEEL, WM_PARENTNOTIFY, WM_ENTERMENULOOP, WM_EXITMENULOOP, WM_NEXTMENU, WM_SIZING, WM_CAPTURECHANGED, WM_MOVING, WM_POWERBROADCAST, WM_DEVICECHANGE, WM_MDICREATE, WM_MDIDESTROY, WM_MDIACTIVATE, WM_MDIRESTORE, WM_MDINEXT, WM_MDIMAXIMIZE, WM_MDITILE, WM_MDICASCADE, WM_MDIICONARRANGE, WM_MDIGETACTIVE, WM_MDISETMENU, WM_ENTERSIZEMOVE, WM_EXITSIZEMOVE, WM_DROPFILES, WM_MDIREFRESHMENU, WM_TOUCH, WM_IME_SETCONTEXT, WM_IME_NOTIFY, WM_IME_CONTROL, WM_IME_COMPOSITIONFULL, WM_IME_SELECT, WM_IME_CHAR, WM_IME_REQUEST, WM_IME_KEYDOWN, WM_IME_KEYUP, WM_MOUSEHOVER, WM_MOUSELEAVE, WM_NCMOUSEHOVER, WM_NCMOUSELEAVE, WM_WTSSESSION_CHANGE, WM_TABLET_FIRST, WM_TABLET_LAST, WM_CUT, WM_COPY, WM_PASTE, WM_CLEAR, WM_UNDO, WM_RENDERFORMAT, WM_RENDERALLFORMATS, WM_DESTROYCLIPBOARD, WM_DRAWCLIPBOARD, WM_PAINTCLIPBOARD, WM_VSCROLLCLIPBOARD, WM_SIZECLIPBOARD, WM_ASKCBFORMATNAME, WM_CHANGECBCHAIN, WM_HSCROLLCLIPBOARD, WM_QUERYNEWPALETTE, WM_PALETTEISCHANGING, WM_PALETTECHANGED, WM_HOTKEY, WM_PRINT, WM_PRINTCLIENT, WM_APPCOMMAND, WM_THEMECHANGED, WM_CLIPBOARDUPDATE, WM_DWMCOMPOSITIONCHANGED, WM_DWMNCRENDERINGCHANGED, WM_DWMCOLORIZATIONCOLORCHANGED, WM_DWMWINDOWMAXIMIZEDCHANGE, WM_DWMSENDICONICTHUMBNAIL, WM_DWMSENDICONICLIVEPREVIEWBITMAP, WM_GETTITLEBARINFOEX, WM_HANDHELDFIRST, WM_HANDHELDLAST, WM_AFXFIRST, WM_AFXLAST, WM_PENWINFIRST, WM_PENWINLAST, WM_APP, WM_USER
Windows messages.
-
WA_ACTIVE, WA_CLICKACTIVE, WA_INACTIVE
User32.WM_ACTIVATE
messagewParam
values.
-
SIZE_RESTORED, SIZE_MINIMIZED, SIZE_MAXIMIZED, SIZE_MAXSHOW, SIZE_MAXHIDE
User32.WM_SIZE
messagewParam
values.
-
DBT_APPYBEGIN, DBT_APPYEND, DBT_DEVNODES_CHANGED, DBT_QUERYCHANGECONFIG, DBT_CONFIGCHANGED, DBT_CONFIGCHANGECANCELED, DBT_MONITORCHANGE
User32.WM_DEVICECHANGE
messagewParam
params.
-
SC_SIZE, SC_MOVE, SC_MINIMIZE, SC_MAXIMIZE, SC_NEXTWINDOW, SC_PREVWINDOW, SC_CLOSE, SC_VSCROLL, SC_HSCROLL, SC_MOUSEMENU, SC_KEYMENU, SC_ARRANGE, SC_RESTORE, SC_TASKLIST, SC_SCREENSAVE, SC_HOTKEY, SC_DEFAULT, SC_MONITORPOWER, SC_CONTEXTHELP, SC_SEPARATOR
System menu command values.
-
MK_LBUTTON, MK_RBUTTON, MK_SHIFT, MK_CONTROL, MK_MBUTTON, MK_XBUTTON1, MK_XBUTTON2
Key state masks for mouse messages.
-
HTERROR, HTTRANSPARENT, HTNOWHERE, HTCLIENT, HTCAPTION, HTSYSMENU, HTGROWBOX, HTSIZE, HTMENU, HTHSCROLL, HTVSCROLL, HTMINBUTTON, HTMAXBUTTON, HTLEFT, HTRIGHT, HTTOP, HTTOPLEFT, HTTOPRIGHT, HTBOTTOM, HTBOTTOMLEFT, HTBOTTOMRIGHT, HTBORDER, HTREDUCE, HTZOOM, HTSIZEFIRST, HTSIZELAST, HTOBJECT, HTCLOSE, HTHELP
Mouse position codes.
-
GWL_WNDPROC, GWL_HINSTANCE, GWL_HWNDPARENT, GWL_STYLE, GWL_EXSTYLE, GWL_USERDATA, GWL_ID
Window field offsets forUser32.GetWindowLongPtr(long, int)
.
-
SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED, SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE, SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE, SW_SHOWDEFAULT, SW_FORCEMINIMIZE, SW_MAX
User32.ShowWindow(long, int)
commands.
-
HWND_TOP, HWND_BOTTOM, HWND_TOPMOST, HWND_NOTOPMOST
Virtual window handles used by theUser32.SetWindowPos(long, long, int, int, int, int, int)
insertAfter argument.
-
HWND_BROADCAST
Virtual window handle used byUser32.PostMessage(long, int, long, long)
that matches all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows.
-
SWP_NOSIZE, SWP_NOMOVE, SWP_NOZORDER, SWP_NOREDRAW, SWP_NOACTIVATE, SWP_FRAMECHANGED, SWP_SHOWWINDOW, SWP_HIDEWINDOW, SWP_NOCOPYBITS, SWP_NOOWNERZORDER, SWP_NOSENDCHANGING, SWP_DRAWFRAME, SWP_NOREPOSITION, SWP_DEFERERASE, SWP_ASYNCWINDOWPOS
Window sizing and positiong flags used by theUser32.SetWindowPos(long, long, int, int, int, int, int)
flags argument.
-
IDI_APPLICATION, IDI_HAND, IDI_QUESTION, IDI_EXCLAMATION, IDI_ASTERISK, IDI_WINLOGO, IDI_SHIELD, IDI_WARNING, IDI_ERROR, IDI_INFORMATION
Standard Icon IDs. Use withUser32.LoadIcon(long, java.nio.ByteBuffer)
.
-
IDC_ARROW, IDC_IBEAM, IDC_WAIT, IDC_CROSS, IDC_UPARROW, IDC_SIZE, IDC_ICON, IDC_SIZENWSE, IDC_SIZENESW, IDC_SIZEWE, IDC_SIZENS, IDC_SIZEALL, IDC_NO, IDC_HAND, IDC_APPSTARTING, IDC_HELP
Standard Cursor IDs. Use withUser32.LoadCursor(long, java.nio.ByteBuffer)
.
-
GCL_MENUNAME, GCL_HBRBACKGROUND, GCL_HCURSOR, GCL_HICON, GCL_HMODULE, GCL_CBWNDEXTRA, GCL_CBCLSEXTRA, GCL_WNDPROC, GCL_STYLE, GCW_ATOM, GCL_HICONSM
Class field offsets forUser32.GetClassLongPtr(long, int)
.
-
QS_KEY, QS_MOUSEMOVE, QS_MOUSEBUTTON, QS_POSTMESSAGE, QS_TIMER, QS_PAINT, QS_SENDMESSAGE, QS_HOTKEY, QS_ALLPOSTMESSAGE, QS_RAWINPUT, QS_MOUSE, QS_INPUT, QS_ALLEVENTS, QS_ALLINPUT
Queue status flags forGetQueueStatus
andMsgWaitForMultipleObjects
-
PM_NOREMOVE, PM_REMOVE, PM_NOYIELD, PM_QS_INPUT, PM_QS_POSTMESSAGE, PM_QS_PAINT, PM_QS_SENDMESSAGE
Remove message flags forUser32.PeekMessage(org.lwjgl.system.windows.MSG, long, int, int, int)
.
-
VK_LBUTTON, VK_RBUTTON, VK_CANCEL, VK_MBUTTON, VK_XBUTTON1, VK_XBUTTON2, VK_BACK, VK_TAB, VK_CLEAR, VK_RETURN, VK_SHIFT, VK_CONTROL, VK_MENU, VK_PAUSE, VK_CAPITAL, VK_KANA, VK_HANGEUL, VK_HANGUL, VK_JUNJA, VK_FINAL, VK_HANJA, VK_KANJI, VK_ESCAPE, VK_CONVERT, VK_NONCONVERT, VK_ACCEPT, VK_MODECHANGE, VK_SPACE, VK_PRIOR, VK_NEXT, VK_END, VK_HOME, VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN, VK_SELECT, VK_PRINT, VK_EXECUTE, VK_SNAPSHOT, VK_INSERT, VK_DELETE, VK_HELP, VK_LWIN, VK_RWIN, VK_APPS, VK_SLEEP, VK_NUMPAD0, VK_NUMPAD1, VK_NUMPAD2, VK_NUMPAD3, VK_NUMPAD4, VK_NUMPAD5, VK_NUMPAD6, VK_NUMPAD7, VK_NUMPAD8, VK_NUMPAD9, VK_MULTIPLY, VK_ADD, VK_SEPARATOR, VK_SUBTRACT, VK_DECIMAL, VK_DIVIDE, VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16, VK_F17, VK_F18, VK_F19, VK_F20, VK_F21, VK_F22, VK_F23, VK_F24, VK_NUMLOCK, VK_SCROLL, VK_OEM_NEC_EQUAL, VK_OEM_FJ_JISHO, VK_OEM_FJ_MASSHOU, VK_OEM_FJ_TOUROKU, VK_OEM_FJ_LOYA, VK_OEM_FJ_ROYA, VK_LSHIFT, VK_RSHIFT, VK_LCONTROL, VK_RCONTROL, VK_LMENU, VK_RMENU, VK_BROWSER_BACK, VK_BROWSER_FORWARD, VK_BROWSER_REFRESH, VK_BROWSER_STOP, VK_BROWSER_SEARCH, VK_BROWSER_FAVORITES, VK_BROWSER_HOME, VK_VOLUME_MUTE, VK_VOLUME_DOWN, VK_VOLUME_UP, VK_MEDIA_NEXT_TRACK, VK_MEDIA_PREV_TRACK, VK_MEDIA_STOP, VK_MEDIA_PLAY_PAUSE, VK_LAUNCH_MAIL, VK_LAUNCH_MEDIA_SELECT, VK_LAUNCH_APP1, VK_LAUNCH_APP2, VK_OEM_1, VK_OEM_PLUS, VK_OEM_COMMA, VK_OEM_MINUS, VK_OEM_PERIOD, VK_OEM_2, VK_OEM_3, VK_OEM_4, VK_OEM_5, VK_OEM_6, VK_OEM_7, VK_OEM_8, VK_OEM_AX, VK_OEM_102, VK_ICO_HELP, VK_ICO_00, VK_PROCESSKEY, VK_ICO_CLEAR, VK_PACKET, VK_OEM_RESET, VK_OEM_JUMP, VK_OEM_PA1, VK_OEM_PA2, VK_OEM_PA3, VK_OEM_WSCTRL, VK_OEM_CUSEL, VK_OEM_ATTN, VK_OEM_FINISH, VK_OEM_COPY, VK_OEM_AUTO, VK_OEM_ENLW, VK_OEM_BACKTAB, VK_ATTN, VK_CRSEL, VK_EXSEL, VK_EREOF, VK_PLAY, VK_ZOOM, VK_NONAME, VK_PA1, VK_OEM_CLEAR
Virtual Keys.
-
WHEEL_DELTA
Value for rolling one detent.
-
SM_CXSCREEN, SM_CYSCREEN, SM_CXVSCROLL, SM_CYHSCROLL, SM_CYCAPTION, SM_CXBORDER, SM_CYBORDER, SM_CXDLGFRAME, SM_CYDLGFRAME, SM_CYVTHUMB, SM_CXHTHUMB, SM_CXICON, SM_CYICON, SM_CXCURSOR, SM_CYCURSOR, SM_CYMENU, SM_CXFULLSCREEN, SM_CYFULLSCREEN, SM_CYKANJIWINDOW, SM_MOUSEPRESENT, SM_CYVSCROLL, SM_CXHSCROLL, SM_DEBUG, SM_SWAPBUTTON, SM_RESERVED1, SM_RESERVED2, SM_RESERVED3, SM_RESERVED4, SM_CXMIN, SM_CYMIN, SM_CXSIZE, SM_CYSIZE, SM_CXFRAME, SM_CYFRAME, SM_CXMINTRACK, SM_CYMINTRACK, SM_CXDOUBLECLK, SM_CYDOUBLECLK, SM_CXICONSPACING, SM_CYICONSPACING, SM_MENUDROPALIGNMENT, SM_PENWINDOWS, SM_DBCSENABLED, SM_CMOUSEBUTTONS, SM_CXFIXEDFRAME, SM_CYFIXEDFRAME, SM_CXSIZEFRAME, SM_CYSIZEFRAME, SM_SECURE, SM_CXEDGE, SM_CYEDGE, SM_CXMINSPACING, SM_CYMINSPACING, SM_CXSMICON, SM_CYSMICON, SM_CYSMCAPTION, SM_CXSMSIZE, SM_CYSMSIZE, SM_CXMENUSIZE, SM_CYMENUSIZE, SM_ARRANGE, SM_CXMINIMIZED, SM_CYMINIMIZED, SM_CXMAXTRACK, SM_CYMAXTRACK, SM_CXMAXIMIZED, SM_CYMAXIMIZED, SM_NETWORK, SM_CLEANBOOT, SM_CXDRAG, SM_CYDRAG, SM_SHOWSOUNDS, SM_CXMENUCHECK, SM_CYMENUCHECK, SM_SLOWMACHINE, SM_MIDEASTENABLED, SM_MOUSEWHEELPRESENT, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_CMONITORS, SM_SAMEDISPLAYFORMAT, SM_IMMENABLED, SM_REMOTESESSION, SM_SHUTTINGDOWN, SM_REMOTECONTROL, SM_CARETBLINKINGENABLED, SM_CXFOCUSBORDER, SM_CYFOCUSBORDER, SM_TABLETPC, SM_MEDIACENTER, SM_STARTER, SM_SERVERR2, SM_MOUSEHORIZONTALWHEELPRESENT, SM_CXPADDEDBORDER, SM_DIGITIZER, SM_MAXIMUMTOUCHES
User32.GetSystemMetrics(int)
codes.
-
TOUCHEVENTF_MOVE, TOUCHEVENTF_DOWN, TOUCHEVENTF_UP, TOUCHEVENTF_INRANGE, TOUCHEVENTF_PRIMARY, TOUCHEVENTF_NOCOALESCE, TOUCHEVENTF_PEN, TOUCHEVENTF_PALM
Touch input flag values (TOUCHINPUT.dwFlags()
).
-
TOUCHINPUTMASKF_TIMEFROMSYSTEM, TOUCHINPUTMASKF_EXTRAINFO, TOUCHINPUTMASKF_CONTACTAREA
Touch input mask values (TOUCHINPUT.dwMask()
).
-
CDS_UPDATEREGISTRY, CDS_TEST, CDS_FULLSCREEN, CDS_GLOBAL, CDS_SET_PRIMARY, CDS_VIDEOPARAMETERS, CDS_ENABLE_UNSAFE_MODES, CDS_DISABLE_UNSAFE_MODES, CDS_RESET, CDS_RESET_EX, CDS_NORESET
-
-
Method Detail
-
getLibrary
public static SharedLibrary getLibrary()
Returns the user32SharedLibrary
.
-
nRegisterClassExW
public static short nRegisterClassExW(long __functionAddress, long lpwcx)
Unsafe version of:User32.RegisterClassEx(org.lwjgl.system.windows.WNDCLASSEX)
-
RegisterClassEx
public static short RegisterClassEx(WNDCLASSEX lpwcx)
Registers a window class for subsequent use in calls to theUser32.CreateWindowEx(int, java.nio.ByteBuffer, java.nio.ByteBuffer, int, int, int, int, int, long, long, long, long)
function.- Parameters:
lpwcx
- aWNDCLASSEX
structure. You must fill the structure with the appropriate class attributes before passing it to the function.
-
nUnregisterClassW
public static int nUnregisterClassW(long __functionAddress, long lpClassName, long hInstance)
Unsafe version of:User32.UnregisterClass(java.nio.ByteBuffer, long)
-
UnregisterClass
public static boolean UnregisterClass(java.nio.ByteBuffer lpClassName, long hInstance) public static boolean UnregisterClass(java.lang.CharSequence lpClassName, long hInstance)
Unregisters a window class, freeing the memory required for the class.- Parameters:
lpClassName
- a null-terminated string or a class atom. IflpClassName
is a string, it specifies the window class name. This class name must have been registered by a previous call to theUser32.RegisterClassEx(org.lwjgl.system.windows.WNDCLASSEX)
function. System classes, such as dialog box controls, cannot be unregistered. If this parameter is an atom, it must be a class atom created by a previous call to theUser32.RegisterClassEx(org.lwjgl.system.windows.WNDCLASSEX)
function. The atom must be in the low-order word oflpClassName
; the high-order word must be zero.hInstance
- a handle to the instance of the module that created the class
-
nCreateWindowExW
public static long nCreateWindowExW(long __functionAddress, int dwExStyle, long lpClassName, long lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, long hWndParent, long hMenu, long hInstance, long lpParam)
-
CreateWindowEx
public static long CreateWindowEx(int dwExStyle, java.nio.ByteBuffer lpClassName, java.nio.ByteBuffer lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, long hWndParent, long hMenu, long hInstance, long lpParam) public static long CreateWindowEx(int dwExStyle, java.lang.CharSequence lpClassName, java.lang.CharSequence lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, long hWndParent, long hMenu, long hInstance, long lpParam)
Creates an overlapped, pop-up, or child window with an extended window style; otherwise, this function is identical to the CreateWindow function.- Parameters:
dwExStyle
- the extended window style of the window being createdlpClassName
- a null-terminated string or a class atom created by a previous call to theUser32.RegisterClassEx(WNDCLASSEX)
function.lpWindowName
- the window name. If the window style specifies a title bar, the window title pointed to bylpWindowName
is displayed in the title bar.dwStyle
- the style of the window being createdx
- the initial horizontal position of the windowy
- the initial vertical position of the windownWidth
- the width, in device units, of the windownHeight
- the height, in device units, of the windowhWndParent
- a handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle.hMenu
- a handle to a menu, or specifies a child-window identifier, depending on the window stylehInstance
- a handle to the instance of the module to be associated with the windowlpParam
- a value to be passed to the window through theCREATESTRUCT
structure (createParams
member) pointed to by thelParam
param of theUser32.WM_CREATE
message.
-
DestroyWindow
public static boolean DestroyWindow(long hWnd)
Destroys the specified window. The function sendsUser32.WM_DESTROY
andUser32.WM_NCDESTROY
messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).If the specified window is a parent or owner window, DestroyWindow automatically destroys the associated child or owned windows when it destroys the parent or owner window. The function first destroys child or owned windows, and then it destroys the parent or owner window.
- Parameters:
hWnd
- a handle to the window to be destroyed
-
DefWindowProc
public static long DefWindowProc(long hWnd, int Msg, long wParam, long lParam)
Calls the default window procedure to provide default processing for any window messages that an application does not process. This function ensures that every message is processed. DefWindowProc is called with the same parameters received by the window procedure.- Parameters:
hWnd
- a handle to the window that received the messageMsg
- the messagewParam
- additional message information. The content of this parameter depends on the value of theMsg
parameter.lParam
- additional message information. The content of this parameter depends on the value of theMsg
parameter.
-
ShowWindow
public static boolean ShowWindow(long hWnd, int nCmdShow)
Sets the specified window's show state.- Parameters:
hWnd
- a handle to the windownCmdShow
- controls how the window is to be shown. This parameter is ignored the first time an application callsShowWindow
, if the program that launched the application provides aSTARTUPINFO
structure. Otherwise, the first timeShowWindow
is called, the value should be the value obtained by theWinMain
function in itsnCmdShow
parameter. In subsequent calls, this parameter can be one of:
-
UpdateWindow
public static boolean UpdateWindow(long hWnd)
Updates the client area of the specified window by sending aUser32.WM_PAINT
message to the window if the window's update region is not empty. The function sends aUser32.WM_PAINT
message directly to the window procedure of the specified window, bypassing the application queue. If the update region is empty, no message is sent.- Parameters:
hWnd
- handle to the window to be updated
-
SetWindowPos
public static boolean SetWindowPos(long hWnd, long hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags)
Changes the size, position, and Z order of a child, pop-up, or top-level window. These windows are ordered according to their appearance on the screen. The topmost window receives the highest rank and is the first window in the Z order.- Parameters:
hWnd
- a handle to the windowhWndInsertAfter
- a handle to the window to precede the positioned window in the Z order. This parameter must be a window handle or one of:User32.HWND_TOP
User32.HWND_BOTTOM
User32.HWND_TOPMOST
User32.HWND_NOTOPMOST
X
- the new position of the left side of the window, in client coordinatesY
- the new position of the top of the window, in client coordinatescx
- the new width of the window, in pixelscy
- the new height of the window, in pixelsuFlags
- the window sizing and positioning flags. One or more of:
-
nSetWindowTextW
public static int nSetWindowTextW(long __functionAddress, long hWnd, long lpString)
Unsafe version of:User32.SetWindowText(long, java.nio.ByteBuffer)
-
SetWindowText
public static boolean SetWindowText(long hWnd, java.nio.ByteBuffer lpString) public static boolean SetWindowText(long hWnd, java.lang.CharSequence lpString)
Changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed. However,SetWindowText
cannot change the text of a control in another application.- Parameters:
hWnd
- a handle to the window or control whose text is to be changedlpString
- the new title or control text
-
nGetMessageW
public static int nGetMessageW(long __functionAddress, long lpMsg, long hWnd, int wMsgFilterMin, int wMsgFilterMax)
Unsafe version of:User32.GetMessage(org.lwjgl.system.windows.MSG, long, int, int)
-
GetMessage
public static boolean GetMessage(MSG lpMsg, long 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. Unlike GetMessage, theUser32.PeekMessage(org.lwjgl.system.windows.MSG, long, int, int, int)
function does not wait for a message to be posted before returning.- Parameters:
lpMsg
- a pointer to anMSG
structure that receives message information from the thread's message queuehWnd
- a handle to the window whose messages are to be retrieved. The window must belong to the current thread.If
hWnd
isNULL
,GetMessage
retrieves messages for any window that belongs to the current thread, and any messages on the current thread's message queue whosehwnd
value isNULL
(see theMSG
structure). Therefore ifhWnd
isNULL
, both window messages and thread messages are processed.If
hWnd
is -1,GetMessage
retrieves only messages on the current thread's message queue whosehwnd
value isNULL
, that is, thread messages as posted byUser32.PostMessage(long, int, long, long)
(when thehWnd
parameter isNULL
) orPostThreadMessage
.wMsgFilterMin
- the integer value of the lowest message value to be retrievedwMsgFilterMax
- the integer value of the highest message value to be retrieved
-
PeekMessage
public static boolean PeekMessage(MSG lpMsg, long hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg)
Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist).- Parameters:
lpMsg
- a pointer to anMSG
structure that receives message informationhWnd
- a handle to the window whose messages are to be retrieved. The window must belong to the current thread.If
hWnd
isNULL
,GetMessage
retrieves messages for any window that belongs to the current thread, and any messages on the current thread's message queue whosehwnd
value isNULL
(see theMSG
structure). Therefore ifhWnd
isNULL
, both window messages and thread messages are processed.If
hWnd
is -1,GetMessage
retrieves only messages on the current thread's message queue whosehwnd
value isNULL
, that is, thread messages as posted byUser32.PostMessage(long, int, long, long)
(when thehWnd
parameter isNULL
) orPostThreadMessage
.wMsgFilterMin
- the integer value of the lowest message value to be retrievedwMsgFilterMax
- the integer value of the highest message value to be retrievedwRemoveMsg
- specifies how messages are to be handled. One of:User32.PM_NOREMOVE
User32.PM_REMOVE
User32.PM_NOYIELD
-
TranslateMessage
public static boolean TranslateMessage(MSG lpMsg)
Translates virtual-key messages into character messages. The character messages are posted to the calling thread's message queue, to be read the next time the thread calls theUser32.GetMessage(org.lwjgl.system.windows.MSG, long, int, int)
orUser32.PeekMessage(org.lwjgl.system.windows.MSG, long, int, int, int)
function.- Parameters:
lpMsg
- anMSG
structure that contains message information retrieved from the calling thread's message queue by using theUser32.GetMessage(org.lwjgl.system.windows.MSG, long, int, int)
orUser32.PeekMessage(org.lwjgl.system.windows.MSG, long, int, int, int)
function.
-
WaitMessage
public static boolean WaitMessage()
Yields control to other threads when a thread has no other messages in its message queue. The WaitMessage function suspends the thread and does not return until a new message is placed in the thread's message queue.
-
DispatchMessage
public static long DispatchMessage(MSG lpmsg)
Dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by theUser32.GetMessage(org.lwjgl.system.windows.MSG, long, int, int)
function.- Parameters:
lpmsg
- a pointer to a structure that contains the message.
-
nPostMessageW
public static int nPostMessageW(long __functionAddress, long hWnd, int Msg, long wParam, long lParam)
Unsafe version of:User32.PostMessage(long, int, long, long)
-
PostMessage
public static boolean PostMessage(long hWnd, int Msg, long wParam, long lParam)
Places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.- Parameters:
hWnd
- a handle to the window whose window procedure is to receive the message. The following values have special meanings:User32.HWND_BROADCAST
- The message is posted to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows. The message is not posted to child windows.NULL
- The function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread.
Msg
- the message to be postedwParam
- additional message-specific informationlParam
- additional message-specific information
-
nSendMessageW
public static int nSendMessageW(long __functionAddress, long hWnd, int Msg, long wParam, long lParam)
Unsafe version of:User32.SendMessage(long, int, long, long)
-
SendMessage
public static boolean SendMessage(long hWnd, int Msg, long wParam, long lParam)
Sends the specified message to a window or windows. TheSendMessage
function calls the window procedure for the specified window and does not return until the window procedure has processed the message.- Parameters:
hWnd
- a handle to the window whose window procedure will receive the message. If this parameter isUser32.HWND_BROADCAST
, the message is sent to all top-level windows in the system, including disabled or invisible unowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.Message sending is subject to UIPI. The thread of a process can send messages only to message queues of threads in processes of lesser or equal integrity level.
Msg
- the message to be sentwParam
- additional message-specific informationlParam
- additional message-specific information
-
AdjustWindowRectEx
public static boolean AdjustWindowRectEx(RECT lpRect, int dwStyle, boolean bMenu, int dwExStyle)
Calculates the required size of the window rectangle, based on the desired size of the client rectangle. The window rectangle can then be passed to theUser32.CreateWindowEx(int, java.nio.ByteBuffer, java.nio.ByteBuffer, int, int, int, int, int, long, long, long, long)
function to create a window whose client area is the desired size.- Parameters:
lpRect
- a pointer to aRECT
structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area.dwStyle
- the window style of the window whose required size is to be calculated. Note that you cannot specify theUser32.WS_OVERLAPPED
style.bMenu
- indicates whether the window has a menudwExStyle
- the extended window style of the window whose required size is to be calculated
-
GetWindowRect
public static boolean GetWindowRect(long hWnd, RECT lpRect)
Retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.- Parameters:
hWnd
- a handle to the windowlpRect
- a pointer to aRECT
structure that receives the screen coordinates of the upper-left and lower-right corners of the window
-
MoveWindow
public static boolean MoveWindow(long hWnd, int X, int Y, int nWidth, int nHeight, boolean bRepaint)
Changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area.- Parameters:
hWnd
- a handle to the windowX
- the new position of the left side of the windowY
- the new position of the top of the windownWidth
- the new width of the windownHeight
- the new height of the windowbRepaint
- indicates whether the window is to be repainted. If this parameter is TRUE, the window receives a message. If the parameter is FALSE, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a child window.
-
GetWindowPlacement
public static boolean GetWindowPlacement(long hWnd, WINDOWPLACEMENT lpwndpl)
Retrieves the show state and the restored, minimized, and maximized positions of the specified window.- Parameters:
hWnd
- a handle to the windowlpwndpl
- a pointer to theWINDOWPLACEMENT
structure that receives the show state and position information.Before calling
GetWindowPlacement
, set the length member toWINDOWPLACEMENT.SIZEOF
.GetWindowPlacement
fails iflpwndpl->length
is not set correctly.
-
SetWindowPlacement
public static boolean SetWindowPlacement(long hWnd, WINDOWPLACEMENT lpwndpl)
Sets the show state and the restored, minimized, and maximized positions of the specified window.- Parameters:
hWnd
- a handle to the windowlpwndpl
- a pointer to theWINDOWPLACEMENT
structure that specifies the new show state and window positions.Before calling
SetWindowPlacement
, set thelength
member of theWINDOWPLACEMENT
structure toWINDOWPLACEMENT.SIZEOF
.SetWindowPlacement
fails if the length member is not set correctly.
-
IsWindowVisible
public static boolean IsWindowVisible(long hWnd)
Determines the visibility state of the specified window.- Parameters:
hWnd
- a handle to the window to be tested
-
IsIconic
public static boolean IsIconic(long hWnd)
Determines whether the specified window is minimized (iconic).- Parameters:
hWnd
- a handle to the window to be tested
-
IsZoomed
public static boolean IsZoomed(long hWnd)
Determines whether a window is maximized.- Parameters:
hWnd
- a handle to the window to be tested
-
BringWindowToTop
public static boolean BringWindowToTop(long hWnd)
Brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If the window is a child window, the top-level parent window associated with the child window is activated.- Parameters:
hWnd
- a handle to the window to bring to the top of the Z order
-
SetWindowLongPtr
public static long SetWindowLongPtr(long hWnd, int nIndex, long dwNewLong)
Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.- Parameters:
hWnd
- a handle to the window and, indirectly, the class to which the window belongsnIndex
- the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of:User32.GWL_WNDPROC
User32.GWL_HINSTANCE
User32.GWL_HWNDPARENT
User32.GWL_STYLE
User32.GWL_EXSTYLE
User32.GWL_USERDATA
User32.GWL_ID
dwNewLong
- the replacement value- Returns:
- the previous value at the given
index
-
GetWindowLongPtr
public static long GetWindowLongPtr(long hWnd, int nIndex)
Retrieves information about the specified window. The function also retrieves the value at a specified offset into the extra window memory.- Parameters:
hWnd
- a handle to the window and, indirectly, the class to which the window belongsnIndex
- the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of:User32.GWL_WNDPROC
User32.GWL_HINSTANCE
User32.GWL_HWNDPARENT
User32.GWL_STYLE
User32.GWL_EXSTYLE
User32.GWL_USERDATA
User32.GWL_ID
-
SetClassLongPtr
public static long SetClassLongPtr(long hWnd, int nIndex, long dwNewLong)
Replaces the specified value at the specified offset in the extra class memory or theWNDCLASSEX
structure for the class to which the specified window belongs.- Parameters:
hWnd
- a handle to the window and, indirectly, the class to which the window belongsnIndex
- the value to be replaced. To set a value in the extra class memory, specify the positive, zero-based byte offset of the value to be set. Valid values are in the range zero through the number of bytes of extra class memory, minus eight; for example, if you specified 24 or more bytes of extra class memory, a value of 16 would be an index to the third integer. To set a value other than theWNDCLASSEX
structure, specify one of:dwNewLong
- the replacement value- Returns:
- if the function succeeds, the return value is the previous value of the specified offset. If this was not previously set, the return value is zero.
If the function fails, the return value is zero. To get extended error information, call
WinBase.getLastError()
.
-
GetClassLongPtr
public static long GetClassLongPtr(long hWnd, int nIndex)
Retrieves the specified value from theWNDCLASSEX
structure associated with the specified window.- Parameters:
hWnd
- a handle to the window and, indirectly, the class to which the window belongsnIndex
- the value to be retrieved. To retrieve a value from the extra class memory, specify the positive, zero-based byte offset of the value to be retrieved. Valid values are in the range zero through the number of bytes of extra class memory, minus eight; for example, if you specified 24 or more bytes of extra class memory, a value of 16 would be an index to the third integer. To retrieve any other value from theWNDCLASSEX
structure, specify one of:
-
SetLayeredWindowAttributes
public static boolean SetLayeredWindowAttributes(long hwnd, int crKey, byte bAlpha, int dwFlags)
- Parameters:
hwnd
- a handle to the layered window. A layered window is created by specifyingUser32.WS_EX_LAYERED
when creating the window with theUser32.CreateWindowEx(int, java.nio.ByteBuffer, java.nio.ByteBuffer, int, int, int, int, int, long, long, long, long)
function or by settingUser32.WS_EX_LAYERED
viaUser32.SetWindowLongPtr(long, int, long)
after the window has been created.crKey
- the transparency color key (0x00bbggrr) to be used when composing the layered window. All pixels painted by the window in this color will be transparent.bAlpha
- the alpha value used to describe the opacity of the layered window. WhenbAlpha
is 0, the window is completely transparent. WhenbAlpha
is 255, the window is opaque.dwFlags
- an action to be taken. One or more of:User32.LWA_COLORKEY
User32.LWA_ALPHA
-
nLoadIconW
public static long nLoadIconW(long __functionAddress, long instance, long iconName)
Unsafe version of:User32.LoadIcon(long, java.nio.ByteBuffer)
-
LoadIcon
public static long LoadIcon(long instance, java.nio.ByteBuffer iconName) public static long LoadIcon(long instance, java.lang.CharSequence iconName)
Loads the specified icon resource from the executable (.exe) file associated with an application instance.- Parameters:
instance
- a handle to an instance of the module whose executable file contains the icon to be loaded. This parameter must beNULL
when a standard icon is being loaded.iconName
- the name of the icon resource to be loaded or one of:User32.IDI_APPLICATION
User32.IDI_HAND
User32.IDI_QUESTION
User32.IDI_EXCLAMATION
User32.IDI_ASTERISK
User32.IDI_WINLOGO
User32.IDI_SHIELD
User32.IDI_WARNING
User32.IDI_ERROR
User32.IDI_INFORMATION
-
nLoadCursorW
public static long nLoadCursorW(long __functionAddress, long instance, long cursorName)
Unsafe version of:User32.LoadCursor(long, java.nio.ByteBuffer)
-
LoadCursor
public static long LoadCursor(long instance, java.nio.ByteBuffer cursorName) public static long LoadCursor(long instance, java.lang.CharSequence cursorName)
Loads the specified cursor resource from the executable (.EXE) file associated with an application instance.- Parameters:
instance
- a handle to an instance of the module whose executable file contains the cursor to be loaded.cursorName
- the name of the cursor resource to be loaded or one of:
-
GetDC
public static long GetDC(long hWnd)
Retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. The device context is an opaque data structure, whose values are used internally by GDI.- Parameters:
hWnd
- a handle to the window whose DC is to be retrieved. If this value isNULL
, GetDC retrieves the DC for the entire screen.
-
ReleaseDC
public static boolean ReleaseDC(long hWnd, long hDC)
Releases a device context (DC), freeing it for use by other applications. The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. It has no effect on class or private DCs.- Parameters:
hWnd
- a handle to the window whose DC is to be releasedhDC
- a handle to the DC to be released
-
GetSystemMetrics
public static int GetSystemMetrics(int index)
Retrieves the specified system metric or system configuration setting.- Parameters:
index
- the system metric or configuration setting to be retrieved. One of:
-
RegisterTouchWindow
public static boolean RegisterTouchWindow(long hWnd, int ulFlags)
Registers a window as being touch-capable.RegisterTouchWindow
must be called on every window that will be used for touch input. This means that if you have an application that has multiple windows within it,RegisterTouchWindow
must be called on every window in that application that uses touch features. Also, an application can callRegisterTouchWindow
any number of times for the same window if it desires to change the modifier flags. A window can be marked as no longer requiring touch input using theUser32.UnregisterTouchWindow(long)
function.- Parameters:
hWnd
- the handle of the window being registered. The function fails withERROR_ACCESS_DENIED
if the calling thread does not own the specified window.ulFlags
- a set of bit flags that specify optional modifications. This field may contain 0 or one or more of:User32.TWF_FINETOUCH
User32.TWF_WANTPALM
- Since:
- Windows 7 (desktop apps only)
-
UnregisterTouchWindow
public static boolean UnregisterTouchWindow(long hWnd)
Registers a window as no longer being touch-capable.- Parameters:
hWnd
- the handle of the window. The function fails withERROR_ACCESS_DENIED
if the calling thread does not own the specified window.- Since:
- Windows 7 (desktop apps only)
-
IsTouchWindow
public static boolean IsTouchWindow(long hWnd, java.nio.IntBuffer pulFlags)
Checks whether a specified window is touch-capable and, optionally, retrieves the modifier flags set for the window's touch capability.- Parameters:
hWnd
- the handle of the window. The function fails withERROR_ACCESS_DENIED
if the calling thread is not on the same desktop as the specified window.pulFlags
- an optional address of theULONG
variable to receive the modifier flags for the specified window's touch capability.- Since:
- Windows 7 (desktop apps only)
-
GetTouchInputInfo
public static boolean GetTouchInputInfo(long hTouchInput, TOUCHINPUT.Buffer pInputs, int cbSize)
Retrieves detailed information about touch inputs associated with a particular touch input handle.- Parameters:
hTouchInput
- the touch input handle received in theLPARAM
of a touch message. The function fails withERROR_INVALID_HANDLE
if this handle is not valid. Note that the handle is not valid after it has been used in a successful call toUser32.CloseTouchInputHandle(long)
or after it has been passed toUser32.DefWindowProc(long, int, long, long)
,User32.PostMessage(long, int, long, long)
,User32.SendMessage(long, int, long, long)
or one of their variants.pInputs
- a pointer to an array ofTOUCHINPUT
structures to receive information about the touch points associated with the specified touch input handlecbSize
- the size, in bytes, of a singleTOUCHINPUT
structure. IfcbSize
is not the size of a singleTOUCHINPUT
structure, the function fails withERROR_INVALID_PARAMETER
.- Since:
- Windows 7 (desktop apps only)
-
CloseTouchInputHandle
public static boolean CloseTouchInputHandle(long hTouchInput)
Closes a touch input handle, frees process memory associated with it, and invalidates the handle.- Parameters:
hTouchInput
- the touch input handle received in theLPARAM
of a touch message. The function fails withERROR_INVALID_HANDLE
if this handle is not valid. Note that the handle is not valid after it has been used in a successful call toUser32.CloseTouchInputHandle(long)
or after it has been passed toUser32.DefWindowProc(long, int, long, long)
,User32.PostMessage(long, int, long, long)
,User32.SendMessage(long, int, long, long)
or one of their variants.- Since:
- Windows 7 (desktop apps only)
-
MonitorFromWindow
public static long MonitorFromWindow(long hWnd, int dwFlags)
Retrieves a handle to the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.- Parameters:
hWnd
- a handle to the window of interestdwFlags
- determines the function's return value if the window does not intersect any display monitor. One of:User32.MONITOR_DEFAULTTONULL
User32.MONITOR_DEFAULTTOPRIMARY
User32.MONITOR_DEFAULTTONEAREST
-
GetMonitorInfo
public static boolean GetMonitorInfo(long hMonitor, MONITORINFOEX lpmi)
Retrieves information about a display monitor.- Parameters:
hMonitor
- a handle to the display monitor of interestlpmi
- a pointer to aMONITORINFOEX
structure that receives information about the specified display monitor.You must set the
cbSize
member of the structure toMONITORINFOEX.SIZEOF
before calling theGetMonitorInfo
function. Doing so lets the function determine the type of structure you are passing to it.
-
EnumDisplayDevices
public static boolean EnumDisplayDevices(java.nio.ByteBuffer lpDevice, int iDevNum, DISPLAY_DEVICE lpDisplayDevice, int dwFlags) public static boolean EnumDisplayDevices(java.lang.CharSequence lpDevice, int iDevNum, DISPLAY_DEVICE lpDisplayDevice, int dwFlags)
Obtains information about the display devices in the current session.- Parameters:
lpDevice
- the device name. IfNULL
, function returns information for the display adapter(s) on the machine, based ondevNum
.iDevNum
- an index value that specifies the display device of interest.The operating system identifies each display device in the current session with an index value. The index values are consecutive integers, starting at 0. If the current session has three display devices, for example, they are specified by the index values 0, 1, and 2.
lpDisplayDevice
- a pointer to aDISPLAY_DEVICE
structure that receives information about the display device specified byiDevNum
.Before calling
EnumDisplayDevices
, you must initialize thecb
member ofDISPLAY_DEVICE
to the size, in bytes, ofDISPLAY_DEVICE
.dwFlags
- set this flag toUser32.EDD_GET_DEVICE_INTERFACE_NAME
to retrieve the device interface name forGUID_DEVINTERFACE_MONITOR
, which is registered by the operating system on a per monitor basis. The value is placed in theDeviceID
member of theDISPLAY_DEVICE
structure returned inlpDisplayDevice
. The resulting device interface name can be used with SetupAPI functions and serves as a link between GDI monitor devices and SetupAPI monitor devices.
-
EnumDisplaySettingsEx
public static boolean EnumDisplaySettingsEx(java.nio.ByteBuffer lpszDeviceName, int iModeNum, DEVMODE lpDevMode, int dwFlags) public static boolean EnumDisplaySettingsEx(java.lang.CharSequence lpszDeviceName, int iModeNum, DEVMODE lpDevMode, int dwFlags)
Retrieves information about one of the graphics modes for a display device. To retrieve information for all the graphics modes for a display device, make a series of calls to this function.- Parameters:
lpszDeviceName
- a pointer to a null-terminated string that specifies the display device about which graphics mode the function will obtain information.This parameter is either
NULL
or aDISPLAY_DEVICE.DeviceName()
returned fromUser32.EnumDisplayDevices(java.nio.ByteBuffer, int, org.lwjgl.system.windows.DISPLAY_DEVICE, int)
. ANULL
value specifies the current display device on the computer that the calling thread is running on.iModeNum
- indicates the type of information to be retrieved.Graphics mode indexes start at zero. To obtain information for all of a display device's graphics modes, make a series of calls to
EnumDisplaySettingsEx
, as follows: SetiModeNum
to zero for the first call, and incrementiModeNum
by one for each subsequent call. Continue calling the function until the return value is zero.When you call
EnumDisplaySettingsEx
withiModeNum
set to zero, the operating system initializes and caches information about the display device. When you callEnumDisplaySettingsEx
withiModeNum
set to a nonzero value, the function returns the information that was cached the last time the function was called withiModeNum
set to zero.This value can be a graphics mode index or one of:
User32.ENUM_CURRENT_SETTINGS
User32.ENUM_REGISTRY_SETTINGS
lpDevMode
- a pointer to aDEVMODE
structure into which the function stores information about the specified graphics mode. Before callingEnumDisplaySettingsEx
, set thedmSize
member toDEVMODE.SIZEOF
, and set thedmDriverExtra
member to indicate the size, in bytes, of the additional space available to receive private driver data.The
EnumDisplaySettingsEx
function will populate thedmFields
member of thelpDevMode
and one or more other members of theDEVMODE
structure. To determine which members were set by the call toEnumDisplaySettingsEx
, inspect thedmFields
bitmask.dwFlags
- this parameter can be one of:User32.EDS_RAWMODE
User32.EDS_ROTATEDMODE
-
ChangeDisplaySettingsEx
public static int ChangeDisplaySettingsEx(java.nio.ByteBuffer lpszDeviceName, DEVMODE lpDevMode, long hwnd, int dwflags, long lParam) public static int ChangeDisplaySettingsEx(java.lang.CharSequence lpszDeviceName, DEVMODE lpDevMode, long hwnd, int dwflags, long lParam)
Changes the settings of the specified display device to the specified graphics mode.- Parameters:
lpszDeviceName
- a pointer to a null-terminated string that specifies the display device whose graphics mode will change. Only display device names as returned byUser32.EnumDisplayDevices(java.nio.ByteBuffer, int, org.lwjgl.system.windows.DISPLAY_DEVICE, int)
are valid.The
lpszDeviceName
parameter can beNULL
. ANULL
value specifies the default display device. The default device can be determined by callingEnumDisplayDevices
and checking for theGDI32.DISPLAY_DEVICE_PRIMARY_DEVICE
flag.lpDevMode
- a pointer to aDEVMODE
structure that describes the new graphics mode. IflpDevMode
isNULL
, all the values currently in the registry will be used for the display setting. PassingNULL
for thelpDevMode
parameter and 0 for thedwFlags
parameter is the easiest way to return to the default mode after a dynamic mode change.The
dmSize
member must be initialized to the size, in bytes, of theDEVMODE
structure. ThedmDriverExtra
member must be initialized to indicate the number of bytes of private driver data following theDEVMODE
structure.hwnd
- reserved; must beNULL
dwflags
- indicates how the graphics mode should be changed. One of:lParam
- ifflags
isUser32.CDS_VIDEOPARAMETERS
,lParam
is a pointer to aVIDEOPARAMETERS
structure. OtherwiselParam
must beNULL
.- Returns:
- one of the following values:
User32.DISP_CHANGE_SUCCESSFUL
User32.DISP_CHANGE_RESTART
User32.DISP_CHANGE_FAILED
User32.DISP_CHANGE_BADMODE
User32.DISP_CHANGE_NOTUPDATED
User32.DISP_CHANGE_BADFLAGS
User32.DISP_CHANGE_BADPARAM
User32.DISP_CHANGE_BADDUALVIEW
-
GetCursorPos
public static boolean GetCursorPos(POINT point)
Retrieves the position of the mouse cursor, in screen coordinates.- Parameters:
point
- a pointer to aPOINT
structure that receives the screen coordinates of the cursor
-
SetCursorPos
public static boolean SetCursorPos(int X, int Y)
Moves the cursor to the specified screen coordinates. If the new coordinates are not within the screen rectangle set by the most recentUser32.ClipCursor(org.lwjgl.system.windows.RECT)
function call, the system automatically adjusts the coordinates so that the cursor stays within the rectangle.- Parameters:
X
- the new x-coordinate of the cursor, in screen coordinates.Y
- the new y-coordinate of the cursor, in screen coordinates.
-
ClipCursor
public static boolean ClipCursor(RECT rect)
Confines the cursor to a rectangular area on the screen. If a subsequent cursor position (set by theUser32.SetCursorPos(int, int)
function or the mouse) lies outside the rectangle, the system automatically adjusts the position to keep the cursor inside the rectangular area.- Parameters:
rect
- a pointer to the structure that contains the screen coordinates of the upper-left and lower-right corners of the confining rectangle. If this parameter isNULL
, the cursor is free to move anywhere on the screen.
-
ShowCursor
public static int ShowCursor(boolean show)
Displays or hides the cursor.This function sets an internal display counter that determines whether the cursor should be displayed. The cursor is displayed only if the display count is greater than or equal to 0. If a mouse is installed, the initial display count is 0. If no mouse is installed, the display count is –1.
- Parameters:
show
- Ifshow
isWinBase.TRUE
, the display count is incremented by one. Ifshow
isWinBase.FALSE
, the display count is decremented by one.- Returns:
- the new display counter
-
SetCursor
public static long SetCursor(long hCursor)
Sets the cursor shape.The cursor is set only if the new cursor is different from the previous cursor; otherwise, the function returns immediately.
The cursor is a shared resource. A window should set the cursor shape only when the cursor is in its client area or when the window is capturing mouse input. In systems without a mouse, the window should restore the previous cursor before the cursor leaves the client area or before it relinquishes control to another window.
If your application must set the cursor while it is in a window, make sure the class cursor for the specified window's class is set to
NULL
. If the class cursor is notNULL
, the system restores the class cursor each time the mouse is moved.The cursor is not shown on the screen if the internal cursor display count is less than zero. This occurs if the application uses the
User32.ShowCursor(boolean)
function to hide the cursor more times than to show the cursor.- Parameters:
hCursor
- a handle to the cursor. The cursor must have been created by theCreateCursor
function or loaded by theUser32.LoadCursor(long, java.nio.ByteBuffer)
orLoadImage
function. If this parameter isNULL
, the cursor is removed from the screen.- Returns:
- the handle to the previous cursor, if there was one
-
IsTouchWindow
public static boolean IsTouchWindow(long hWnd, int[] pulFlags)
Array version of:User32.IsTouchWindow(long, java.nio.IntBuffer)
-
-