Search code examples
c++windowsparent-childhwnd

Invalid HWND for parent


Is it possible to have a valid HWND with a valid parent, and then the parent become invalid without the child becoming invalid?


Solution

  • No, see the documentation for DestroyWindow:

    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.