The window to be destroyed must have been created by the thread that is issuing this call. Before hwnd is itself destroyed, all child windows of hwnd are also destroyed.
If hwnd cannot be destroyed, for example because hwnd is an invalid window handle or is not associated with the current thread, rc returns FALSE.
Note: If hwnd is locked, this call does not return until the window is unlocked (and destroyed).
Messages may be received from other processes or threads during the processing of this call.
If a Presentation Space is associated with the window, it is disassociated from it by this function. If the presentation space was obtained by use of GpiCreatePS then it is disassociated from the window, but not destroyed. That is, this function calls GpiAssociate to disassociate the presentation space but does not call GpiDestroyPS. If the presentation space was obtained by use of the WinGetPS function, it is released by this function; that is, this function performs the WinReleasePS function.
Messages sent by this call are:
If the window being destroyed is the active window, both the active window and the input focus window are transferred to another window when the window is destroyed. The window that becomes the active window is the next window, as defined for the "Alt+Esc" function. This usually corresponds to the next application in the sequence. The input focus transfers to whichever window the new active window decides should have it.
If a menu window is being destroyed, any bit maps associated with the menu are not deleted. They will be deleted automatically when the application terminates.