WINDOWPLACEMENT structure

Contains information about the placement of a window on the screen.

Syntax


typedef struct tagWINDOWPLACEMENT {
  UINT  length;
  UINT  flags;
  UINT  showCmd;
  POINT ptMinPosition;
  POINT ptMaxPosition;
  RECT  rcNormalPosition;
} WINDOWPLACEMENT, *PWINDOWPLACEMENT, *LPWINDOWPLACEMENT;

Members

length

Type: UINT

The length of the structure, in bytes. Before calling the GetWindowPlacement or SetWindowPlacement functions, set this member to sizeof(WINDOWPLACEMENT).

GetWindowPlacement and SetWindowPlacement fail if this member is not set correctly.

flags

Type: UINT

The flags that control the position of the minimized window and the method by which the window is restored. This member can be one or more of the following values.

ValueMeaning
WPF_ASYNCWINDOWPLACEMENT
0x0004

If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.

WPF_RESTORETOMAXIMIZED
0x0002

The restored window will be maximized, regardless of whether it was maximized before it was minimized. This setting is only valid the next time the window is restored. It does not change the default restoration behavior.

This flag is only valid when the SW_SHOWMINIMIZED value is specified for the showCmd member.

WPF_SETMINPOSITION
0x0001

The coordinates of the minimized window may be specified.

This flag must be specified if the coordinates are set in the ptMinPosition member.

 

showCmd

Type: UINT

The current show state of the window. This member can be one of the following values.

ValueMeaning
SW_HIDE
0

Hides the window and activates another window.

SW_MAXIMIZE
3

Maximizes the specified window.

SW_MINIMIZE
6

Minimizes the specified window and activates the next top-level window in the z-order.

SW_RESTORE
9

Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when restoring a minimized window.

SW_SHOW
5

Activates the window and displays it in its current size and position.

SW_SHOWMAXIMIZED
3

Activates the window and displays it as a maximized window.

SW_SHOWMINIMIZED
2

Activates the window and displays it as a minimized window.

SW_SHOWMINNOACTIVE
7

Displays the window as a minimized window.

This value is similar to SW_SHOWMINIMIZED, except the window is not activated.

SW_SHOWNA
8

Displays the window in its current size and position.

This value is similar to SW_SHOW, except the window is not activated.

SW_SHOWNOACTIVATE
4

Displays a window in its most recent size and position.

This value is similar to SW_SHOWNORMAL, except the window is not activated.

SW_SHOWNORMAL
1

Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag when displaying the window for the first time.

 

ptMinPosition

Type: POINT

The coordinates of the window's upper-left corner when the window is minimized.

ptMaxPosition

Type: POINT

The coordinates of the window's upper-left corner when the window is maximized.

rcNormalPosition

Type: RECT

The window's coordinates when the window is in the restored position.

Remarks

If the window is a top-level window that does not have the WS_EX_TOOLWINDOW window style, then the coordinates represented by the following members are in workspace coordinates: ptMinPosition, ptMaxPosition, and rcNormalPosition. Otherwise, these members are in screen coordinates.

Workspace coordinates differ from screen coordinates in that they take the locations and sizes of application toolbars (including the taskbar) into account. Workspace coordinate (0,0) is the upper-left corner of the workspace area, the area of the screen not being used by application toolbars.

The coordinates used in a WINDOWPLACEMENT structure should be used only by the GetWindowPlacement and SetWindowPlacement functions. Passing workspace coordinates to functions which expect screen coordinates (such as SetWindowPos) will result in the window appearing in the wrong location. For example, if the taskbar is at the top of the screen, saving window coordinates using GetWindowPlacement and restoring them using SetWindowPos causes the window to appear to "creep" up the screen.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

See also

Reference
GetWindowPlacement
SetWindowPlacement
SetWindowPos
ShowWindow
POINT
RECT
Conceptual
Windows

 

 

Community Additions

ADD
Show:
© 2014 Microsoft