Reputation: 137
Is it possible to have a valid HWND with a valid parent, and then the parent become invalid without the child becoming invalid?
Upvotes: 2
Views: 455
Reputation: 179907
Only if you'd first call SetParent
on the child window. DestroyWindow
will destoy a window and all its current child windows.
Since windows have thread affinity, and children have the same thread affinity as their parents, there's no risk of a race condition between SetParent
and DestroyWindow
.
Upvotes: 0
Reputation: 70701
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.
Upvotes: 2