Microsoft Windows CE 3.0  

SetParent

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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

HWND
SetParent( HWND
hWndChild
, HWND
hWndNewParent
);

Parameters

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

Windows NT 5.0 and later:If this parameter is HWND_MESSAGE, the child window becomes a message-only window.

Return Values

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 SetParentfunction 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 hWndChildparameter is visible, the system performs the appropriate redrawing and repainting.

For compatibility reasons, SetParentdoes not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, if hWndNewParentis NULL, you should also clear the WS_CHILD bit and set the WS_POPUP style after calling SetParent. Conversely, if hWndNewParentis not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winuser.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

GetParent