Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DestroyWindow

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function destroys the specified window. The function sends a WM_DESTROY message to the window to deactivate it and removes the keyboard focus from it. The function also destroys the window's menu, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).

If the specified window is a parent or owner window, DestroyWindow automatically destroys the associated child or owned windows when it destroys the parent or owner window. The function first destroys child or owned windows, and then it destroys the parent or owner window.

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


BOOL DestroyWindow( 
  HWND hWnd 
); 

hWnd

[in] Handle to the window to be destroyed.

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

The DestroyWindow function does not support the WM_PARENTNOTIFY message.

DestroyWindow destroys children of the specified window.

DestroyWindow does not flush the thread message queue.

Do not use DestroyWindow in one thread to destroy a window created by a different thread.

Headerwinuser.h
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2015 Microsoft