Win32, x64


To get the location and size of a given window.




HWND is a window handle obtained, for example, by using %hw (Handle) or %lc (Handle of Last Control). Other arguments are returned with the pixel coordinates and dimensions of the window.


For main windows the X,Y location is in absolute screen coordinates. For child windows attached by %aw to a frame, the coordinates are relative to the top left corner of the frame. For controls and other child (%ch (Child Window)) windows X and Y are relative to the parent window.

This routine (together with the associated move and resize routines) can be used on windows created using WINIO@ or on other windows if the window handle is available. They are particularly useful to control the placement of MDI child windows.

Moving individual controls and un-framed child windows may be unwise as it can cause controls to overlap on the screen.

Windows will be partially or totally concealed if they are moved outside the area of the screen or the enclosing window or frame (in the case of child windows). This is normal and can be used if desired.

Some interesting effects can be obtained by using these functions. For example, suppose that a child window (which might contain a large graphics region) were attached to a frame that was too small to contain it. By calling MOVE_WINDOW@ (e.g. in response to a scroll call-back function) with negative values of X and/or Y, the contents of the window could be scrolled within the frame.

The API function BringWindowToTop may also be useful when re-arranging windows.

See also




Copyright © 1999-2023 Silverfrost Limited