Can a child thread of parent GUI dialog thread create a child window?

不问归期 提交于 2020-01-16 05:13:08

问题


Can you create a child window from a secondary child thread or it must be created from GUI thread? Assuming the life time of child thread is until the end of program.


回答1:


Unlike other operating systems, each thread in windows can host its own message pump, and thus windows.

Care must be taken as child windows need to communicate synchronously with their parent - so you must take care to ensure that neither thread holds a critical section or synchronous object while calling an window API that could result in a SendMessage being sent - this WILL deadlock the threads.



来源:https://stackoverflow.com/questions/3640543/can-a-child-thread-of-parent-gui-dialog-thread-create-a-child-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!