MoveWindow

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function changes the position and dimensions of the specified window. For a top-level window, the position and dimensions are relative to the upper-left corner of the screen. For a child window, they are relative to the upper-left corner of the parent window's client area.

Syntax

BOOL MoveWindow( 
  HWND hWnd, 
  int X, 
  int Y, 
  int nWidth, 
  int nHeight, 
  BOOL bRepaint 
); 

Parameters

  • hWnd
    [in] Handle to the window.
  • X
    [in] Specifies the new position of the left side of the window.
  • Y
    [in] Specifies the new position of the top of the window.
  • nWidth
    [in] Specifies the new width of the window.
  • nHeight
    [in] Specifies the new height of the window.
  • bRepaint
    [in] Boolean that specifies whether the window is to be repainted. However, this parameter is ignored and is assumed to be FALSE. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of moving a child window. The application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

The bRepaint parameter is ignored and is assumed to be FALSE. This means that the system places the WM_PAINT message in the message queue associated with the window. The message loop dispatches the WM_PAINT message only after dispatching all other messages in the queue.

MoveWindow sends WM_WINDOWPOSCHANGED, WM_MOVE, and WM_SIZE messages to the window.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

SetWindowPos
UpdateWindow
WM_PAINT
Windows Functions