父GUI对话框线程的子线程可以创建子窗口吗?
可以从辅助子线程创建子窗口,还是必须从GUI线程创建子窗口?假设子线程的生命周期是直到程序结束.
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.
与其他操作系统不同,Windows中的每个线程都可以承载自己的消息泵,因此也可以承载Windows.
Unlike other operating systems, each thread in windows can host its own message pump, and thus windows.
必须小心,因为子窗口需要与其父窗口进行同步通信-因此,在调用可能会导致发送SendMessage的窗口API时,您必须注意确保两个线程都没有持有关键部分或同步对象.将使线程死锁.
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.