I want to have two threads to handle windows messages. One for key/mouse input in the client area (this thread also takes care of game logic) and one for the rest because I am making a game and some messages cause DefWindowProc() to block (thus freezing the game).
How can I achieve this?
Contrary to what Cody wrote, you most definitely can process messages from multiple threads. However, this is not a customizable free-for-all. Rather, windows have thread affinity: each thread will receive the messages sent or posted to windows created by that thread. There’s no way to have any window’s messages delivered to any other thread.
For your particular situation, why not create a worker thread with its own hidden window and message loop? Any time the main window receives a message you don’t want to process in the main thread, post it to the other window, it will be queued to and processed by the worker thread.