다음을 통해 공유


SetParent

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function changes the parent window of the specified child window.

Syntax

HWND SetParent( 
  HWND hWndChild, 
  HWND hWndNewParent 
); 

Parameters

  • hWndChild
    [in] Handle to the child window.
  • hWndNewParent
    [in] Handle to the new parent window. If this parameter is NULL, the desktop window becomes the new parent window.

Return Value

A handle to the previous parent window indicates success. NULL indicates failure. To get extended error information, call GetLastError.

Remarks

An application can use the SetParent function to set the parent window of a pop-up, overlapped, or child window. The new parent window and the child window must belong to the same application.

If the window identified by the hWndChild parameter is visible, the system performs the appropriate redrawing and repainting.

For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, it is not possible to change a window from parent to child or from child to parent.

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

GetParent
Windows Functions