GET_WINDOW_LOCATION@

Platform

Win32, x64

Purpose

To get the location and size of a given window.

Syntax

 SUBROUTINE GET_WINDOW_LOCATION@( HWND, X, Y, WIDTH,
+ HEIGHT)
 INTEGER(7) HWND
 INTEGER X, Y, WIDTH, HEIGHT

Description

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.

Notes

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

MOVE_WINDOW@, RESIZE_WINDOW@

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited