开发者

Invalid HWND for parent

开发者 https://www.devze.com 2023-01-23 18:42 出处:网络
Is it possible to have a valid HWND with a valid parent, and then the parent become invalid witho开发者_C百科ut the child becoming invalid?No, see the documentation for DestroyWindow:

Is it possible to have a valid HWND with a valid parent, and then the parent become invalid witho开发者_C百科ut the child becoming invalid?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号