To destroy a window, call the DestroyWindow function. When a thread or process terminates, Windows CE removes all windows that are owned by that thread or process. Windows that are removed when a thread or process terminates do not always receive WM_DESTROY messages. For this reason, it is recommended that you manually destroy windows. When a window is destroyed, the system hides the window, sends a WM_DESTROY message to the window procedure of the window being destroyed, and removes any associated internal data. The window handle becomes invalid and can no longer be used by the application.
Destroying a window automatically destroys the window's descendant windows. The DestroyWindow function first sends a WM_DESTROY message to the initial window being destroyed and then to its descendant windows.
You should destroy any window that is no longer needed. Before destroying a window, save or remove any data associated with the window and release system resources allocated to the window.
Destroying a window does not affect the window class from which the window is created. You can still create new windows by using the class, and any existing windows of that class continue to operate.