com.jniwrapper.win32.ui
Class Wnd

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.Pointer.Void
          extended bycom.jniwrapper.win32.Handle
              extended bycom.jniwrapper.win32.ui.Wnd
All Implemented Interfaces:
com.jniwrapper.IntegerParameter, com.jniwrapper.PointerParameter
Direct Known Subclasses:
DesktopWindow

public class Wnd
extends Handle

This class provides methods and constants to work with native windows. It corresponds to HWND native Windows data type.


Nested Class Summary
static class Wnd.Ancestor
          Enumeration of possible window ancestors.
static class Wnd.HotKey
          The options class for determining a combination of hot key modifiers.
static class Wnd.ShowWindowCommand
          ShowWindowCommand class represents enumeration of commands to use in ShowWindow function.
 
Field Summary
static java.lang.String FUNCTION_GET_WINDOW_THREAD_PROCESS_ID
           
static FunctionName FUNCTION_GetDlgItemText
           
static FunctionName FUNCTION_SetDlgItemText
           
static int GW_CHILD
           
static int GW_HWNDFIRST
           
static int GW_HWNDLAST
           
static int GW_HWNDNEXT
           
static int GW_HWNDPREV
           
static int GW_OWNER
           
static int GWL_EXSTYLE
           
static int GWL_HINSTANCE
           
static int GWL_HWNDPARENT
           
static int GWL_ID
           
static int GWL_STYLE
           
static int GWL_USERDATA
           
static int GWL_WNDPROC
           
static int HWND_BOTTOM
           
static int HWND_NOTOPMOST
           
static int HWND_TOP
           
static int HWND_TOPMOST
           
static int LWA_ALPHA
           
static int LWA_COLORKEY
           
static int OPAQUE
           
static int RDW_ALLCHILDREN
           
static int RDW_ERASE
           
static int RDW_ERASENOW
           
static int RDW_FRAME
           
static int RDW_INTERNALPAINT
           
static int RDW_INVALIDATE
           
static int RDW_NOCHILDREN
           
static int RDW_NOERASE
           
static int RDW_NOFRAME
           
static int RDW_NOINTERNALPAINT
           
static int RDW_UPDATENOW
           
static int RDW_VALIDATE
           
static int SWP_ASYNCWINDOWPOS
           
static int SWP_DEFERERASE
           
static int SWP_DRAWFRAME
           
static int SWP_FRAMECHANGED
           
static int SWP_HIDEWINDOW
           
static int SWP_NOACTIVATE
           
static int SWP_NOCOPYBITS
           
static int SWP_NOMOVE
           
static int SWP_NOOWNERZORDER
           
static int SWP_NOREDRAW
           
static int SWP_NOREPOSITION
           
static int SWP_NOSENDCHANGING
           
static int SWP_NOSIZE
           
static int SWP_NOZORDER
           
static int SWP_SHOWWINDOW
           
static int TRANSPARENT
           
static int WS_BORDER
           
static int WS_CAPTION
           
static int WS_CHILD
           
static int WS_CHILDWINDOW
           
static int WS_CLIPCHILDREN
           
static int WS_CLIPSIBLINGS
           
static int WS_DISABLED
           
static int WS_DLGFRAME
           
static int WS_EX_ACCEPTFILES
           
static int WS_EX_APPWINDOW
           
static int WS_EX_CLIENTEDGE
           
static int WS_EX_CONTEXTHELP
           
static int WS_EX_CONTROLPARENT
           
static int WS_EX_DLGMODALFRAME
           
static int WS_EX_LAYERED
           
static int WS_EX_LEFT
           
static int WS_EX_LEFTSCROLLBAR
           
static int WS_EX_LTRREADING
           
static int WS_EX_MDICHILD
           
static int WS_EX_NOPARENTNOTIFY
           
static int WS_EX_OVERLAPPEDWINDOW
           
static int WS_EX_PALETTEWINDOW
           
static int WS_EX_RIGHT
           
static int WS_EX_RIGHTSCROLLBAR
           
static int WS_EX_RTLREADING
           
static int WS_EX_STATICEDGE
           
static int WS_EX_TOOLWINDOW
           
static int WS_EX_TOPMOST
           
static int WS_EX_TRANSPARENT
           
static int WS_EX_WINDOWEDGE
           
static int WS_GROUP
           
static int WS_HSCROLL
           
static int WS_ICONIC
           
static int WS_MAXIMIZE
           
static int WS_MAXIMIZEBOX
           
static int WS_MINIMIZE
           
static int WS_MINIMIZEBOX
           
static int WS_OVERLAPPED
           
static int WS_OVERLAPPEDWINDOW
           
static int WS_POPUP
           
static int WS_POPUPWINDOW
           
static int WS_SIZEBOX
           
static int WS_SYSMENU
           
static int WS_TABSTOP
           
static int WS_THICKFRAME
           
static int WS_TILED
           
static int WS_TILEDWINDOW
           
static int WS_VISIBLE
           
static int WS_VSCROLL
           
 
Fields inherited from class com.jniwrapper.win32.Handle
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
Wnd()
           
Wnd(java.awt.Component component)
          Constructs an instance getting the handle from the passed AWT component.
Wnd(long value)
          Constructs a new instance with the passed handle value.
 
Method Summary
 DC beginPaint(PaintStruct paintStruct)
          Prepares a specified window for painting.
 void bringToTop()
          Brings the window to the top of the Z order.
static long callWindowProc(Handle wndProc, Wnd wnd, com.jniwrapper.UInt msg, com.jniwrapper.Pointer.Void wParam, com.jniwrapper.Pointer.Void lParam)
          Passes message information to a specified window procedure.
 void centerInDesktop()
          Centers the window over the desktop.
 Point clientToScreen(Point point)
          Converts the client-area coordinates of a specified point to screen coordinates.
 java.lang.Object clone()
           
static Wnd createWindow(int windowStyleEx, java.lang.String className, java.lang.String windowName, int windowStyle, long x, long y, long nWidth, long nHeight, Wnd hWndParent, Handle hMenu, Handle hInstance, Handle lpParam)
          Creates a new window with extended style.
static Wnd createWindow(java.lang.String className)
          Creates a new window by its class name.
static Wnd createWindow(java.lang.String className, java.lang.String windowName, int windowStyle, long x, long y, long nWidth, long nHeight, Wnd hWndParent, Handle hMenu, Handle hInstance, Handle lpParam)
          Creates a new window.
 void destroy()
          Destroys a window.
 boolean enableWindow(boolean enable)
          This function is designed for enabling/disabling this window.
 void endPaint(PaintStruct paintStruct)
          Marks the end of painting.
 void eventLoop()
          Executes event loop for itself.
static void eventLoop(long hwnd)
          Executes infinite event loop handling cycle for the window specified by the passed handle value.
static Wnd findWindow(java.lang.String className)
          Searches a window by a specified class name.
static Wnd findWindow(java.lang.String className, java.lang.String windowName)
          Searches the window by a specified class name and its title.
static Wnd findWindowByName(java.lang.String windowName)
          Searches a window by a specified name.
static Wnd findWindowEx(Wnd parent, java.lang.String className, java.lang.String windowName)
          Searches a child window by specified class name and its title.
 boolean flashWindow(FlashInfo flashInfo)
          Starts or stops window flashing depending on a passed parameter.
static java.util.List getAllWindows()
          Returns all top-level windows on the screen.
 Wnd getAncestor(Wnd.Ancestor ancestor)
          Returns the ancestor of this window.
 Rect getBounds()
          Returns window bounds.
 java.util.List getChildWindows()
          Returns child windows that belong to the current window.
static java.util.List getChildWindows(Wnd parent)
          Returns child windows that belong to a specified parent window.
 Rect getClientRect()
          Returns a window client rectangle.
 Size getClientSize()
          Returns window's client size (width and height).
static Wnd getDesktopWindow()
          Returns a desktop window handle.
 java.lang.String getDlgItemText(int idDlgItem)
          Returns the title or text associated with a control in a dialog box.
static Wnd getFocus()
          Retrieves window that has keyboard focus if the window is attached to the message queue of calling thread.
static Wnd getForegroundWindow()
          Returns a handle to the foreground window (the window with which the user is currently working).
 Wnd.HotKey getHotKey()
          Returns the currently set window hot key or null if hot key isn't set.
 boolean getLayeredWindowAttributes(ColorRef crKey, com.jniwrapper.Int8 bAlpha, com.jniwrapper.UInt32 dwFlags)
          Retrieves the opacity and transparency color key of a layered window.
 Wnd getParent()
          Returns the window parent.
 int getProcessId()
          Returns the process identifier.
 Region getRegion()
          Returns a copy of the window region of a window.
 Size getSize()
          Returns window size (width and height).
 int getThreadId()
          Returns the identifier of the thread that created this window.
static java.util.List getThreadWindows(long threadID)
          Returns all non-child windows associated with a specified thread.
 byte getTransparency()
           
 boolean getUpdateRect(Rect rect)
          Retrieves the coordinates of the smallest rectangle that completely encloses the update region of the specified window.
 boolean getUpdateRect(Rect rect, boolean erase)
          Retrieves the coordinates of the smallest rectangle that completely encloses the update region of the specified window.
 Wnd getWindow(int uCmd)
          Returns a child, parent or sibling window for the current window.
 java.lang.String getWindowClassName()
          Returns the name of the window class.
 long getWindowExStyle()
           
static Wnd getWindowFromPoint(int x, int y)
          Returns a handle to the window that contains the specified point.
 long getWindowLong(int nIndex)
          Returns an attribute of the window.
 WindowPlacement getWindowPlacement()
          Retrieves the show state and the restored, minimized, and maximized positions of the window.
 Rect getWindowRect()
          Returns the bounding rectangle of the window.
 long getWindowStyle()
           
 java.lang.String getWindowText()
          Returns text of a specified window's title bar (if it has one).
 void invalidateRect(Rect rect, boolean erase)
          Adds a rectangle to the specified window's update region.
 boolean isBorderVisible()
          Checks if the window border is visible.
 boolean isCaptionVisible()
          Checks if the window caption is visible.
 boolean isMaximized()
          Checks if the window is maximized.
 boolean isMinimized()
          Checks if this window is minimized.
 boolean isPalleteWindow()
           
 boolean isTransparent()
           
 boolean isVisible()
          Returns true if the window is visible.
 boolean isWindow()
          Checks if this handle is real pointer to an existing window.
 void moveWindow(int x, int y, int width, int height)
          Changes the position and dimensions of a specified window.
 void moveWindow(int x, int y, int width, int height, boolean repaint)
          Changes the position and dimensions of a specified window.
 boolean peekMessage(long msg, boolean remove)
           
 boolean peekMessage(Msg msg, long filterMin, long filterMax, boolean remove)
           
 boolean postMessage(int msg, long wParam, long lParam)
          Posts a message in the message queue.
 void redraw(Rect updateRect, Region updateRegion, int flags)
          Updates a specified rectangle or region in the window's client area.
 Point screenToClient(Point point)
          Converts the screen coordinates of a specified point on the screen to client-area coordinates.
 boolean sendMessage(int msg, long wParam, long lParam)
          Deprecated. use sendMessageEx(int, long, long) instead.
 long sendMessage(int msg, com.jniwrapper.Parameter wParam, com.jniwrapper.Parameter lParam)
          Sends a message to the specified window.
 long sendMessageEx(int msg, long wParam, long lParam)
          Sends a message to a window.
 void setBorderVisible(boolean value)
          Shows or hides the window border.
 void setCaptionVisible(boolean value)
          Shows or hides the window caption.
 void setContinuousRepainting(boolean value)
          Forces continuous window repainting.
 boolean setDlgItemText(int idDlgItem, java.lang.String string)
          Sets the title or text of a control in a dialog box.
 Wnd setFocus()
          Sets the keyboard focus to the specified window.
 void setForeground()
          Puts the thread that created the specified window into the foreground and activates the window.
 void setHotKey(Wnd.HotKey hotKey)
          Registers a system-wide hot key, which activates the window, that corresponds to this handle.
 void setLayeredWindowAttributes(ColorRef crKey, byte bAlpha, int dwFlags)
          Sets opacity and transparency of a layered window.
 void setPalleteWindow(boolean palleteWindow)
          Sets a pallete window style.
 void setParent(Wnd parent)
          Changes the parent of a window.
 boolean setPosition(Wnd wndInsertAfter, long x, long y, long cx, long cy, long flags)
          Changes the size, position, and Z order of a window.
 Region setRegion(Region region)
          Sets a custom window region.
 void setRegion(Region region, boolean redraw)
          Sets a new window region.
 void setRounded(boolean rounded)
          Makes the window rounded (with rounded corners).
 void setRounded(boolean rounded, int ellipseWidth, int ellipseHeight)
          Makes the window rounded (with rounded corners).
 void setTopmost(boolean topmost)
          Makes window topmost.
 void setTransparency(byte transparency)
          Sets window transparency.
 void setTransparent(boolean transparent)
          Sets or removes window transparancy.
 void setTransparent(byte transparency)
          Sets or remove window trancparency.
 void setVisible(boolean visible)
          Shows or hides the window.
 void setWindowExStyle(long flags)
          Sets extended window style.
 void setWindowIcon(Icon icon, Icon.IconType iconType)
          Assigns a specified icon to the window.
 void setWindowLong(int nIndex, long dwNewLong)
          Sets an attribute of the window.
 long setWindowLong(int nIndex, com.jniwrapper.Parameter newValue)
          Sets an attribute of the window.
 void setWindowPlacement(WindowPlacement placement)
          Set new window placement.
 void setWindowStyle(long flags)
          Sets window style.
 void show(Wnd.ShowWindowCommand command)
          Sets a specified window's show state.
 void update()
          Updates the client area of the window.
 
Methods inherited from class com.jniwrapper.win32.Handle
closeHandle, equals, waitFor, waitFor
 
Methods inherited from class com.jniwrapper.Pointer.Void
asFunction, asFunction, asTypedPointer, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
 
Methods inherited from class com.jniwrapper.Parameter
, a, a, acceptIOPerformer, asReturnValue, b, dataBufferAssigned, getAlignedLength, getAlignmentRequirement, getDataBuffer, getDataBufferOffset, indent, pop, push, read, read, setDataBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

GW_HWNDFIRST

public static final int GW_HWNDFIRST
See Also:
Constant Field Values

GW_HWNDLAST

public static final int GW_HWNDLAST
See Also:
Constant Field Values

GW_HWNDNEXT

public static final int GW_HWNDNEXT
See Also:
Constant Field Values

GW_HWNDPREV

public static final int GW_HWNDPREV
See Also:
Constant Field Values

GW_OWNER

public static final int GW_OWNER
See Also:
Constant Field Values

GW_CHILD

public static final int GW_CHILD
See Also:
Constant Field Values

FUNCTION_GET_WINDOW_THREAD_PROCESS_ID

public static final java.lang.String FUNCTION_GET_WINDOW_THREAD_PROCESS_ID
See Also:
Constant Field Values

FUNCTION_SetDlgItemText

public static final FunctionName FUNCTION_SetDlgItemText

FUNCTION_GetDlgItemText

public static final FunctionName FUNCTION_GetDlgItemText

WS_OVERLAPPED

public static final int WS_OVERLAPPED
See Also:
Constant Field Values

WS_POPUP

public static final int WS_POPUP
See Also:
Constant Field Values

WS_CHILD

public static final int WS_CHILD
See Also:
Constant Field Values

WS_MINIMIZE

public static final int WS_MINIMIZE
See Also:
Constant Field Values

WS_VISIBLE

public static final int WS_VISIBLE
See Also:
Constant Field Values

WS_DISABLED

public static final int WS_DISABLED
See Also:
Constant Field Values

WS_CLIPSIBLINGS

public static final int WS_CLIPSIBLINGS
See Also:
Constant Field Values

WS_CLIPCHILDREN

public static final int WS_CLIPCHILDREN
See Also:
Constant Field Values

WS_MAXIMIZE

public static final int WS_MAXIMIZE
See Also:
Constant Field Values

WS_CAPTION

public static final int WS_CAPTION
See Also:
Constant Field Values

WS_BORDER

public static final int WS_BORDER
See Also:
Constant Field Values

WS_DLGFRAME

public static final int WS_DLGFRAME
See Also:
Constant Field Values

WS_VSCROLL

public static final int WS_VSCROLL
See Also:
Constant Field Values

WS_HSCROLL

public static final int WS_HSCROLL
See Also:
Constant Field Values

WS_SYSMENU

public static final int WS_SYSMENU
See Also:
Constant Field Values

WS_THICKFRAME

public static final int WS_THICKFRAME
See Also:
Constant Field Values

WS_GROUP

public static final int WS_GROUP
See Also:
Constant Field Values

WS_TABSTOP

public static final int WS_TABSTOP
See Also:
Constant Field Values

WS_MINIMIZEBOX

public static final int WS_MINIMIZEBOX
See Also:
Constant Field Values

WS_MAXIMIZEBOX

public static final int WS_MAXIMIZEBOX
See Also:
Constant Field Values

WS_OVERLAPPEDWINDOW

public static final int WS_OVERLAPPEDWINDOW
See Also:
Constant Field Values

WS_POPUPWINDOW

public static final int WS_POPUPWINDOW
See Also:
Constant Field Values

WS_CHILDWINDOW

public static final int WS_CHILDWINDOW
See Also:
Constant Field Values

WS_TILED

public static final int WS_TILED
See Also:
Constant Field Values

WS_ICONIC

public static final int WS_ICONIC
See Also:
Constant Field Values

WS_SIZEBOX

public static final int WS_SIZEBOX
See Also:
Constant Field Values

WS_TILEDWINDOW

public static final int WS_TILEDWINDOW
See Also:
Constant Field Values

WS_EX_DLGMODALFRAME

public static final int WS_EX_DLGMODALFRAME
See Also:
Constant Field Values

WS_EX_NOPARENTNOTIFY

public static final int WS_EX_NOPARENTNOTIFY
See Also:
Constant Field Values

WS_EX_TOPMOST

public static final int WS_EX_TOPMOST
See Also:
Constant Field Values

WS_EX_ACCEPTFILES

public static final int WS_EX_ACCEPTFILES
See Also:
Constant Field Values

WS_EX_TRANSPARENT

public static final int WS_EX_TRANSPARENT
See Also:
Constant Field Values

WS_EX_MDICHILD

public static final int WS_EX_MDICHILD
See Also:
Constant Field Values

WS_EX_TOOLWINDOW

public static final int WS_EX_TOOLWINDOW
See Also:
Constant Field Values

WS_EX_WINDOWEDGE

public static final int WS_EX_WINDOWEDGE
See Also:
Constant Field Values

WS_EX_CLIENTEDGE

public static final int WS_EX_CLIENTEDGE
See Also:
Constant Field Values

WS_EX_CONTEXTHELP

public static final int WS_EX_CONTEXTHELP
See Also:
Constant Field Values

WS_EX_RIGHT

public static final int WS_EX_RIGHT
See Also:
Constant Field Values

WS_EX_LEFT

public static final int WS_EX_LEFT
See Also:
Constant Field Values

WS_EX_RTLREADING

public static final int WS_EX_RTLREADING
See Also:
Constant Field Values

WS_EX_LTRREADING

public static final int WS_EX_LTRREADING
See Also:
Constant Field Values

WS_EX_LEFTSCROLLBAR

public static final int WS_EX_LEFTSCROLLBAR
See Also:
Constant Field Values

WS_EX_RIGHTSCROLLBAR

public static final int WS_EX_RIGHTSCROLLBAR
See Also:
Constant Field Values

WS_EX_CONTROLPARENT

public static final int WS_EX_CONTROLPARENT
See Also:
Constant Field Values

WS_EX_STATICEDGE

public static final int WS_EX_STATICEDGE
See Also:
Constant Field Values

WS_EX_APPWINDOW

public static final int WS_EX_APPWINDOW
See Also:
Constant Field Values

WS_EX_OVERLAPPEDWINDOW

public static final int WS_EX_OVERLAPPEDWINDOW
See Also:
Constant Field Values

WS_EX_PALETTEWINDOW

public static final int WS_EX_PALETTEWINDOW
See Also:
Constant Field Values

WS_EX_LAYERED

public static final int WS_EX_LAYERED
See Also:
Constant Field Values

LWA_COLORKEY

public static final int LWA_COLORKEY
See Also:
Constant Field Values

LWA_ALPHA

public static final int LWA_ALPHA
See Also:
Constant Field Values

SWP_NOSIZE

public static final int SWP_NOSIZE
See Also:
Constant Field Values

SWP_NOMOVE

public static final int SWP_NOMOVE
See Also:
Constant Field Values

SWP_NOZORDER

public static final int SWP_NOZORDER
See Also:
Constant Field Values

SWP_NOREDRAW

public static final int SWP_NOREDRAW
See Also:
Constant Field Values

SWP_NOACTIVATE

public static final int SWP_NOACTIVATE
See Also:
Constant Field Values

SWP_FRAMECHANGED

public static final int SWP_FRAMECHANGED
See Also:
Constant Field Values

SWP_SHOWWINDOW

public static final int SWP_SHOWWINDOW
See Also:
Constant Field Values

SWP_HIDEWINDOW

public static final int SWP_HIDEWINDOW
See Also:
Constant Field Values

SWP_NOCOPYBITS

public static final int SWP_NOCOPYBITS
See Also:
Constant Field Values

SWP_NOOWNERZORDER

public static final int SWP_NOOWNERZORDER
See Also:
Constant Field Values

SWP_NOSENDCHANGING

public static final int SWP_NOSENDCHANGING
See Also:
Constant Field Values

SWP_DRAWFRAME

public static final int SWP_DRAWFRAME
See Also:
Constant Field Values

SWP_NOREPOSITION

public static final int SWP_NOREPOSITION
See Also:
Constant Field Values

SWP_DEFERERASE

public static final int SWP_DEFERERASE
See Also:
Constant Field Values

SWP_ASYNCWINDOWPOS

public static final int SWP_ASYNCWINDOWPOS
See Also:
Constant Field Values

HWND_TOP

public static final int HWND_TOP
See Also:
Constant Field Values

HWND_BOTTOM

public static final int HWND_BOTTOM
See Also:
Constant Field Values

HWND_TOPMOST

public static final int HWND_TOPMOST
See Also:
Constant Field Values

HWND_NOTOPMOST

public static final int HWND_NOTOPMOST
See Also:
Constant Field Values

GWL_WNDPROC

public static final int GWL_WNDPROC
See Also:
Constant Field Values

GWL_HINSTANCE

public static final int GWL_HINSTANCE
See Also:
Constant Field Values

GWL_HWNDPARENT

public static final int GWL_HWNDPARENT
See Also:
Constant Field Values

GWL_STYLE

public static final int GWL_STYLE
See Also:
Constant Field Values

GWL_EXSTYLE

public static final int GWL_EXSTYLE
See Also:
Constant Field Values

GWL_USERDATA

public static final int GWL_USERDATA
See Also:
Constant Field Values

GWL_ID

public static final int GWL_ID
See Also:
Constant Field Values

RDW_INVALIDATE

public static final int RDW_INVALIDATE
See Also:
Constant Field Values

RDW_INTERNALPAINT

public static final int RDW_INTERNALPAINT
See Also:
Constant Field Values

RDW_ERASE

public static final int RDW_ERASE
See Also:
Constant Field Values

RDW_VALIDATE

public static final int RDW_VALIDATE
See Also:
Constant Field Values

RDW_NOINTERNALPAINT

public static final int RDW_NOINTERNALPAINT
See Also:
Constant Field Values

RDW_NOERASE

public static final int RDW_NOERASE
See Also:
Constant Field Values

RDW_NOCHILDREN

public static final int RDW_NOCHILDREN
See Also:
Constant Field Values

RDW_ALLCHILDREN

public static final int RDW_ALLCHILDREN
See Also:
Constant Field Values

RDW_UPDATENOW

public static final int RDW_UPDATENOW
See Also:
Constant Field Values

RDW_ERASENOW

public static final int RDW_ERASENOW
See Also:
Constant Field Values

RDW_FRAME

public static final int RDW_FRAME
See Also:
Constant Field Values

RDW_NOFRAME

public static final int RDW_NOFRAME
See Also:
Constant Field Values

OPAQUE

public static final int OPAQUE
See Also:
Constant Field Values

TRANSPARENT

public static final int TRANSPARENT
See Also:
Constant Field Values
Constructor Detail

Wnd

public Wnd()

Wnd

public Wnd(long value)
Constructs a new instance with the passed handle value.

Parameters:
value - native window handle.

Wnd

public Wnd(java.awt.Component component)
Constructs an instance getting the handle from the passed AWT component.

Parameters:
component - the component to get the handle from.
See Also:
WindowTools.getWindowHandle(Component)
Method Detail

eventLoop

public void eventLoop()
Executes event loop for itself.


eventLoop

public static void eventLoop(long hwnd)
Executes infinite event loop handling cycle for the window specified by the passed handle value.

Parameters:
hwnd - a window handle to run the event loop for.

findWindow

public static Wnd findWindow(java.lang.String className,
                             java.lang.String windowName)
Searches the window by a specified class name and its title.

Parameters:
className -
windowName -
Returns:
handle of the found window if succeeds.

findWindowEx

public static Wnd findWindowEx(Wnd parent,
                               java.lang.String className,
                               java.lang.String windowName)
Searches a child window by specified class name and its title.

Parameters:
parent - handle of the parent window.
className -
windowName -
Returns:
handle of the found window if succeeds.

findWindow

public static Wnd findWindow(java.lang.String className)
Searches a window by a specified class name.

Parameters:
className -
Returns:
handle of the found window if succeeds.

findWindowByName

public static Wnd findWindowByName(java.lang.String windowName)
Searches a window by a specified name.

Parameters:
windowName -
Returns:
handle of the found window if succeeds.

getDesktopWindow

public static Wnd getDesktopWindow()
Returns a desktop window handle.

Returns:
desktop window handle.

createWindow

public static Wnd createWindow(java.lang.String className,
                               java.lang.String windowName,
                               int windowStyle,
                               long x,
                               long y,
                               long nWidth,
                               long nHeight,
                               Wnd hWndParent,
                               Handle hMenu,
                               Handle hInstance,
                               Handle lpParam)
Creates a new window.

Parameters:
className - a registered window class name.
windowName - the window name.
windowStyle -
x - the horizontal position of the window.
y - the vertical position of the window.
nWidth - the window width.
nHeight - the window height.
hWndParent - a handle to a parent or an owner window.
hMenu - a menu handle or a child identifier.
hInstance - a handle to an application instance.
lpParam - window-creation data.
Returns:
instance of a newly created window.

createWindow

public static Wnd createWindow(int windowStyleEx,
                               java.lang.String className,
                               java.lang.String windowName,
                               int windowStyle,
                               long x,
                               long y,
                               long nWidth,
                               long nHeight,
                               Wnd hWndParent,
                               Handle hMenu,
                               Handle hInstance,
                               Handle lpParam)
Creates a new window with extended style.

Parameters:
windowStyleEx - extended window style.
className - a registered window class name.
windowName - the window name.
windowStyle -
x - the horizontal position of the window.
y - the vertical position of the window.
nWidth - the window width.
nHeight - the window height.
hWndParent - a handle to a parent or an owner window.
hMenu - a menu handle or a child identifier.
hInstance - a handle to an application instance.
lpParam - window-creation data.
Returns:
instance of a newly created window.

createWindow

public static Wnd createWindow(java.lang.String className)
Creates a new window by its class name.

Parameters:
className - a new window class name.
Returns:
a new window instance.

update

public void update()
Updates the client area of the window.


destroy

public void destroy()
Destroys a window.


getSize

public Size getSize()
Returns window size (width and height).

Returns:
window size (width and height).

getClientSize

public Size getClientSize()
Returns window's client size (width and height).

Returns:
window's client size (width and height).

getBounds

public Rect getBounds()
Returns window bounds.

Returns:
window bounds.

getWindowRect

public Rect getWindowRect()
Returns the bounding rectangle of the window.

Returns:
the bounding rectangle of the window.

centerInDesktop

public void centerInDesktop()
Centers the window over the desktop.


getClientRect

public Rect getClientRect()
Returns a window client rectangle.

Returns:
window client rectangle.

setRegion

public void setRegion(Region region,
                      boolean redraw)
Sets a new window region.

Parameters:
region - a new region.
redraw - if true, the window will be redrawn.

getRegion

public Region getRegion()
Returns a copy of the window region of a window.

Returns:
window region of the window.

setPosition

public boolean setPosition(Wnd wndInsertAfter,
                           long x,
                           long y,
                           long cx,
                           long cy,
                           long flags)
Changes the size, position, and Z order of a window.

Parameters:
wndInsertAfter - a window to precede the positioned window in the Z order.
x - position of the left side of the window.
y - position of the top of the window.
cx - a new width of the window.
cy - a new height of the window.
flags - window sizing and positioning flags.

beginPaint

public DC beginPaint(PaintStruct paintStruct)
Prepares a specified window for painting.

Parameters:
paintStruct - paint data
Returns:
DC if succeeds.

endPaint

public void endPaint(PaintStruct paintStruct)
Marks the end of painting.

Parameters:
paintStruct - paint data.

sendMessage

public boolean sendMessage(int msg,
                           long wParam,
                           long lParam)
Deprecated. use sendMessageEx(int, long, long) instead.

Sends a message to a window.

Parameters:
msg - a message to be sent.
wParam - WPARAM
lParam - LPARAM
Returns:
If the function succeeds, the return value is nonzero.

sendMessageEx

public long sendMessageEx(int msg,
                          long wParam,
                          long lParam)
Sends a message to a window.

Parameters:
msg - a message to be sent.
wParam - WPARAM
lParam - LPARAM
Returns:
the return value meaning depends on the message.

peekMessage

public boolean peekMessage(long msg,
                           boolean remove)

peekMessage

public boolean peekMessage(Msg msg,
                           long filterMin,
                           long filterMax,
                           boolean remove)

postMessage

public boolean postMessage(int msg,
                           long wParam,
                           long lParam)
Posts a message in the message queue.

Parameters:
msg - a message to be posted.
wParam - WPARAM
lParam - LPARAM
Returns:
If the function succeeds, the return value is nonzero.

show

public void show(Wnd.ShowWindowCommand command)
Sets a specified window's show state.

Parameters:
command - Specifies how the window is to be shown.

setWindowLong

public void setWindowLong(int nIndex,
                          long dwNewLong)
Sets an attribute of the window.

Parameters:
nIndex - nIndex the zero-based offset to the value to be retrieved.
dwNewLong - specifies a new long value.

setWindowLong

public long setWindowLong(int nIndex,
                          com.jniwrapper.Parameter newValue)
Sets an attribute of the window.

Parameters:
nIndex - nIndex the zero-based offset to the value to be retrieved.
newValue - specifies a new value.
Returns:
if function succeeds, the return result is the previous value; otherwise zero.

getWindowLong

public long getWindowLong(int nIndex)
Returns an attribute of the window.

Parameters:
nIndex - a zero-based offset to the value to be retrieved.
Returns:
a requested value.

setLayeredWindowAttributes

public void setLayeredWindowAttributes(ColorRef crKey,
                                       byte bAlpha,
                                       int dwFlags)
Sets opacity and transparency of a layered window.

Parameters:
crKey - a value that specifies the transparency color key to be used when composing the layered window.
bAlpha - opacity of the layered window.
dwFlags - an action to take.

getLayeredWindowAttributes

public boolean getLayeredWindowAttributes(ColorRef crKey,
                                          com.jniwrapper.Int8 bAlpha,
                                          com.jniwrapper.UInt32 dwFlags)
Retrieves the opacity and transparency color key of a layered window.

Parameters:
crKey - Receives the transparency color key to be used when composing the layered window. All pixels painted by the window in this color will be transparent. This can be null if the argument is not needed.
bAlpha - Receives the Alpha value used to describe the opacity of the layered window. When the variable referred to by pbAlpha is 0, the window is completely transparent. When the variable referred to by pbAlpha is 255, the window is opaque. This can be null if the argument is not needed.
dwFlags - Receives a layering flag. This can be null if the argument is not needed.
Returns:
If the function succeeds, the return value is true. If the function fails, the return value is false.

redraw

public void redraw(Rect updateRect,
                   Region updateRegion,
                   int flags)
Updates a specified rectangle or region in the window's client area.

Parameters:
updateRect - update rectangle handle.
updateRegion - update region handle.
flags - redraw flags.

setParent

public void setParent(Wnd parent)
Changes the parent of a window.

Parameters:
parent - a new parent window.

getParent

public Wnd getParent()
Returns the window parent.

Returns:
window parent.

getAncestor

public Wnd getAncestor(Wnd.Ancestor ancestor)
Returns the ancestor of this window.

Parameters:
ancestor - the ancestor to be retrieved
Returns:
ancestor of this window

bringToTop

public void bringToTop()
Brings the window to the top of the Z order. NOTE:this function does not make a window a top-level window.


setForeground

public void setForeground()
Puts the thread that created the specified window into the foreground and activates the window. Keyboard input is directed to the window, and various visual cues are changed for the user.


callWindowProc

public static long callWindowProc(Handle wndProc,
                                  Wnd wnd,
                                  com.jniwrapper.UInt msg,
                                  com.jniwrapper.Pointer.Void wParam,
                                  com.jniwrapper.Pointer.Void lParam)
Passes message information to a specified window procedure.

Parameters:
wndProc - a window procedure.
wnd - handle to window procedure to receive the message.
msg - message
wParam - WPARAM
lParam - LPARAM
Returns:
value that specifies the result of the message processing and depends on the message sent.

moveWindow

public void moveWindow(int x,
                       int y,
                       int width,
                       int height,
                       boolean repaint)
Changes the position and dimensions of a specified window.

Parameters:
x - a new left side.
y - a new top side.
width - a new width.
height - a new height.
repaint - specifies whether the window is to be repainted.

moveWindow

public void moveWindow(int x,
                       int y,
                       int width,
                       int height)
Changes the position and dimensions of a specified window.

Parameters:
x - a new left side.
y - a new top side.
width - a new width.
height - a new height.

getUpdateRect

public boolean getUpdateRect(Rect rect,
                             boolean erase)
Retrieves the coordinates of the smallest rectangle that completely encloses the update region of the specified window.

Parameters:
erase - specifies whether the background in the update region is to be erased.
Returns:
the coordinates of the smallest rectangle that completely encloses the update region of the specified window.

getUpdateRect

public boolean getUpdateRect(Rect rect)
Retrieves the coordinates of the smallest rectangle that completely encloses the update region of the specified window.

Returns:
the coordinates of the smallest rectangle that completely encloses the update region of the specified window.

flashWindow

public boolean flashWindow(FlashInfo flashInfo)
Starts or stops window flashing depending on a passed parameter.

Parameters:
flashInfo - a structure that configures the flashing.
Returns:
true if the function succeeds; otherwise false.

getWindowClassName

public java.lang.String getWindowClassName()
Returns the name of the window class.

Returns:
window class name.

getWindow

public Wnd getWindow(int uCmd)
Returns a child, parent or sibling window for the current window.

Parameters:
uCmd - type of the returned window, one of GW_ constants.
Returns:
child, parent or sibling window for the current window.

clone

public java.lang.Object clone()
Overrides:
clone in class Handle

screenToClient

public Point screenToClient(Point point)
Converts the screen coordinates of a specified point on the screen to client-area coordinates. The method does not modify the passed point instance.

Parameters:
point - screen coordinates.
Returns:
converted point of the client-area coordinates.

clientToScreen

public Point clientToScreen(Point point)
Converts the client-area coordinates of a specified point to screen coordinates. The method does not modify the passed point instance.

Parameters:
point - contains the client coordinates to be converted.
Returns:
converted point of the sreen coordinates.

getAllWindows

public static java.util.List getAllWindows()
Returns all top-level windows on the screen.

Returns:
all top-level windows on the screen.

getChildWindows

public static java.util.List getChildWindows(Wnd parent)
Returns child windows that belong to a specified parent window.

Parameters:
parent - a parent window whose child windows are to be enumerated . If this parameter is NULL, this function is equivalent to getAllWindows()
Returns:
child windows that belong to the specified parent window.

getChildWindows

public java.util.List getChildWindows()
Returns child windows that belong to the current window.

Returns:
child windows that belong to the current window.

getThreadWindows

public static java.util.List getThreadWindows(long threadID)
Returns all non-child windows associated with a specified thread.

Parameters:
threadID - specifies the thread whose windows are to be enumerated.
Returns:
all non-child windows associated with the specified thread.

getWindowText

public java.lang.String getWindowText()
Returns text of a specified window's title bar (if it has one). If the specified window is a control, the text of the control is returned.

Returns:
text of the specified window's title bar.

setVisible

public void setVisible(boolean visible)
Shows or hides the window.

Parameters:
visible - if true, shows this window; otherwise, hides this window.

isVisible

public boolean isVisible()
Returns true if the window is visible.

Returns:
true if the window is visible.

setWindowStyle

public void setWindowStyle(long flags)
Sets window style.

Parameters:
flags -

getWindowStyle

public long getWindowStyle()
Returns:
window style flags.

setWindowExStyle

public void setWindowExStyle(long flags)
Sets extended window style.

Parameters:
flags -

getWindowExStyle

public long getWindowExStyle()
Returns:
extended window style flags.

isTransparent

public boolean isTransparent()
Returns:
true, if the window is transparent; otherwise false.

setTransparent

public void setTransparent(boolean transparent)
Sets or removes window transparancy.
NOTE: The sun.java2d.noddraw=true JVM option is required for transparency feature.

Parameters:
transparent - specifies whether or not to make window transparent

setTransparent

public void setTransparent(byte transparency)
Sets or remove window trancparency. Added for compatibility with Windows 2000.

Parameters:
transparency - 0 makes the window completely opaque, 255 makes it completely transparent.

getTransparency

public byte getTransparency()
Returns:
a window transparency value.

setTransparency

public void setTransparency(byte transparency)
Sets window transparency.
NOTE: The sun.java2d.noddraw=true JVM option is required for transparency feature.

Parameters:
transparency - 255 makes the window completely transparent, 0 makes it completely opaque.

isPalleteWindow

public boolean isPalleteWindow()
Returns:
true, if the window has pallete style; otherwise false.

setPalleteWindow

public void setPalleteWindow(boolean palleteWindow)
Sets a pallete window style.

Parameters:
palleteWindow -

setTopmost

public void setTopmost(boolean topmost)
Makes window topmost.

Parameters:
topmost -

setRounded

public void setRounded(boolean rounded,
                       int ellipseWidth,
                       int ellipseHeight)
Makes the window rounded (with rounded corners).

Parameters:
rounded -
ellipseWidth -
ellipseHeight -

setRounded

public void setRounded(boolean rounded)
Makes the window rounded (with rounded corners).

Parameters:
rounded -

setWindowIcon

public void setWindowIcon(Icon icon,
                          Icon.IconType iconType)
Assigns a specified icon to the window.

Parameters:
icon -

setCaptionVisible

public void setCaptionVisible(boolean value)
Shows or hides the window caption.

Parameters:
value -

isCaptionVisible

public boolean isCaptionVisible()
Checks if the window caption is visible.

Returns:
true, if the window caption is visible.

setBorderVisible

public void setBorderVisible(boolean value)
Shows or hides the window border.

Parameters:
value -

isBorderVisible

public boolean isBorderVisible()
Checks if the window border is visible.

Returns:
true, if the window border is visible.

setRegion

public Region setRegion(Region region)
Sets a custom window region. Returns a previously assigned region in order to restore it later.

Parameters:
region -
Returns:
region previously assigned to the window.

setContinuousRepainting

public void setContinuousRepainting(boolean value)
Forces continuous window repainting.

Parameters:
value - if true, continuous window repainting; if false - default.

setFocus

public Wnd setFocus()
Sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue.

Returns:
If the function succeeds, the return value is the handle to the window that previously had the keyboard focus.

getFocus

public static Wnd getFocus()
Retrieves window that has keyboard focus if the window is attached to the message queue of calling thread.

Returns:
window that has keyboard focus.

getThreadId

public int getThreadId()
Returns the identifier of the thread that created this window.

Returns:
the identifier of the thread that created this window

getProcessId

public int getProcessId()
Returns the process identifier.

Returns:
the process identifier

invalidateRect

public void invalidateRect(Rect rect,
                           boolean erase)
Adds a rectangle to the specified window's update region.

Parameters:
rect - the client coordinates of the rectangle to be added to the update region. If it is null, the entire client area is added to the update region.
erase - Specifies whether the background within the update region is to be erased when the update region is processed

setHotKey

public void setHotKey(Wnd.HotKey hotKey)
Registers a system-wide hot key, which activates the window, that corresponds to this handle.

Parameters:
hotKey - specifies the hot key.
Throws:
java.lang.RuntimeException - if the method is unsuccessful.

getHotKey

public Wnd.HotKey getHotKey()
Returns the currently set window hot key or null if hot key isn't set.

Returns:
the currently set window hot key or null if hot key isn't set.

isWindow

public boolean isWindow()
Checks if this handle is real pointer to an existing window.

Returns:
true is this handle is real window; false otherwise

getForegroundWindow

public static Wnd getForegroundWindow()
Returns a handle to the foreground window (the window with which the user is currently working).

Returns:
a handle to the foreground window

getWindowFromPoint

public static Wnd getWindowFromPoint(int x,
                                     int y)
Returns a handle to the window that contains the specified point.

Parameters:
x - specifies the x-coordinate of the point
y - specifies the y-coordinate of the point
Returns:
a handle to the window that contains the specified point

isMaximized

public boolean isMaximized()
Checks if the window is maximized.

Returns:
true, if the window is maximized

isMinimized

public boolean isMinimized()
Checks if this window is minimized.

Returns:
true, if the window is minimized, false otherwise

getWindowPlacement

public WindowPlacement getWindowPlacement()
Retrieves the show state and the restored, minimized, and maximized positions of the window.

Returns:
window placement structure

setWindowPlacement

public void setWindowPlacement(WindowPlacement placement)
Set new window placement.

Parameters:
placement - new window placement

sendMessage

public long sendMessage(int msg,
                        com.jniwrapper.Parameter wParam,
                        com.jniwrapper.Parameter lParam)
Sends a message to the specified window.

Parameters:
msg - message
wParam - WPARAM
lParam - LPARAM
Returns:
the return value meaning depends on the message.

setDlgItemText

public boolean setDlgItemText(int idDlgItem,
                              java.lang.String string)
Sets the title or text of a control in a dialog box.

Parameters:
idDlgItem - Specifies the control with a title or text to be set
string - String that contains the text to be copied to the control
Returns:
If the function succeeds, the return value is true

getDlgItemText

public java.lang.String getDlgItemText(int idDlgItem)
Returns the title or text associated with a control in a dialog box.

Parameters:
idDlgItem - Specifies the control with a title or text to be set
Returns:
return value is true

enableWindow

public boolean enableWindow(boolean enable)
This function is designed for enabling/disabling this window.

Parameters:
enable - true - enables this window; false - otherwise
Returns:
result of operation