CWnd::DestroyWindow

Syntax

virtual BOOL DestroyWindow();

Remarks

Destroys the Windows window attached to CWnd. The DestroyWindow member function sends appropriate messages to CWnd to deactivate it and remove the input focus. It also destroys CWnd's menu, flushes the application queue, destroys outstanding timers, removes Clipboard ownership, and breaks the Clipboard-viewer chain if CWnd is at the top of the viewer chain. It sends WM_DESTROY and WM_NCDESTROY messages to the window. It does not destroy the CWnd object.

If CWnd is the parent of any windows, these child windows are automatically destroyed when the parent window is destroyed. The DestroyWindow member function destroys child windows first, and then CWnd itself.

The DestroyWindow member function also destroys modeless dialog boxes created by the CreateDialog Windows function.

If the CWnd being destroyed is a child window and does not have the WS_NOPARENTNOTIFY style set, then the WM_PARENTNOTIFY message is sent to the parent.

Return Value

Specifies whether the window is destroyed. It is TRUE if the window is destroyed; otherwise FALSE.

See Also

::CreateDialog, CWnd::OnDestroy, CWnd::Detach, ::DestroyWindow