Windows have thread affinity. If you want to create windows on multiple threads then each creating thread should have its own message pump (loop).
How to maintain windows native event loop and windows creation in different thread
hi,
I’m building a multithreaded Windows native application. I want all the native interactive operations to be handled by the main thread and the operations like window creation to happen in a different thread by API calls. So, I have my event loop in the main thread, and window creation is done in a different thread. While I follow this kind of structure, the event loop in the main thread is stuck, as the GetMessage() in the event loop is reading from the main thread's message queue while the window and the respective message are in another thread.
Is there any way to post the message from the window thread to the main thread without using the main thread’s threadid? It would be very helpful if you could give any kind of solution for this