Jump to content

WM ADJUSTWINDOWPOS

From EDM2
Revision as of 22:30, 13 April 2025 by Martini (talk | contribs) (Created page with "This message is sent by the WinSetWindowPos call to enable the window to adjust its new position or size whenever it is about to be moved. ==Syntax== <PRE> param1 PSWP pswp; SWP structure pointer.: param2 ULONG flzero; Zero.: </PRE> ==Parameters== ;pswp (PSWP) - Input : SWP structure pointer. The structure has been filled in by the WinSetWindowPos function with the proposed move or size data. The control can adjust this new positi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This message is sent by the WinSetWindowPos call to enable the window to adjust its new position or size whenever it is about to be moved.

Syntax

param1
    PSWP    pswp;    /* SWP structure pointer. */

param2
    ULONG   flzero;  /* Zero. */

Parameters

pswp (PSWP) - Input
SWP structure pointer. The structure has been filled in by the WinSetWindowPos function with the proposed move or size data. The control can adjust this new position by changing the contents of the SWP structure. It can change the x or y fields to adjust its new position; or the cx or cy fields to adjust its new size, or the hwndInsertBehind field to adjust its new z-order.
flzero (ULONG) - Input
Zero.

Returns

flResult (ULONG) - returns
Window-adjustment status indicators. These indicators are passed on to the WM_WINDOWPOSCHANGED message that is sent after the window state change has occurred. Bits 0 through 15 of this parameter are reserved for system use and bits 16 through 31 are available for application use.
0
No changes have been made
AWP_MINIMIZED
The frame window has been minimized.
AWP_MAXIMIZED
The frame window has been maximized.
AWP_RESTORED
The frame window has been restored.
AWP_ACTIVATE
The frame window has been activated.
AWP_DEACTIVATE
The frame window has been deactivated.

Remarks

Frame controls can respond to this message to reposition themselves or resize themselves in the window frame.

Menu controls respond to this message as follows:

MS_ACTIONBAR not specified
The SWP cx and cy fields are set so that the menu window exactly contains all of the items in the menu. The SWP x and y fields are not changed.
MS_ACTIONBAR specified and MS_TITLEBUTTON not specified
The items in the menu are arranged such that all of the items are visible within the width specified by the SWP cx field. This formatting may cause the menu items to be arranged in multiple lines. The SWP cx field is set to include all of the lines of the menu. The SWP x and y fields are not changed.
MS_ACTIONBAR specified and MS_TITLEBUTTON specified
The SWP cx value is set to the accumulated width of the items in the menu. The height specified in the SWP cy field is not changed. In both instances, the SWP cx and cy fields are only altered if SWP_SIZE is specified in the fl field. Instead, the width of MS_TITLEBUTTON menus is determined by the accumulated width of the items in the menu.

A list box does two things:

  • Changes the height so as to accommodate an exact number of items.
  • Automatically outsets its border. This means, for example, that the x, y, width, and height fields in the resource file specify the working area of the listbox. The border is drawn outside this area.

The entry field control, if ES_MARGIN is specified, outsets its margin. This means that in the resource file, the numbers specified as the x-, and y-position of an entry field control are taken to be the position where the first character of text is drawn, not where the lower-left corner of the surrounding box is drawn. Similarly, the height and width parameters apply to the editable area of the control; consequently, they do not include the margin.

When a dialog is created with WinCreateDlg or WinLoadDlg, a WM_ADJUSTWINDOWPOS message is sent to each child window after the dialog window is created, with a pointer to a SWP structure containing fl equal to SWP_SIZE | SWP_MOVE and the x, y, cy, and cx fields initialized to the current size and position of the window. The message enables the control to adjust its size or position, usually to compensate for its border, or margin, or both.

Default Processing

The default window procedure takes no action on this message, other than to set flResult to 0.