开发者

Invalid HWND for parent

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜