Hi Aurel,
Your WndProc() is the only place where you're supposed to process messages that are coming to the two main windows of your application. The same callback can also be used for any additional windows that you might add in the future as long as these windows are not of any special type e.g. control or dialog windows. And yes, you can differentiate between the windows by their handles like you do. From this standpoint, your design is absolutely correct.
I'd only suggest you observe the following simple rules when working with messages in this callback:
Firstly, almost every message is supposed to return a special value from this callback to the system. Presently all your messages fall through to the common Return DefWindowProc hwnd, wMsg, wParam, lParam command. This means that whatever you do in your message handlers, the system will also add its default processing after all your actions. If you look attentively into the MSDN, you will see that each window message entry there has the following hint:
Return Values
An application should return N if it processes this message.
where N is a numeric value that the callback should return to avoid default processing. Most of the messages should return 0 or 1, for example
Case WM_PAINT
BitBlt hdc, 0, 0, width, height, hmemdc, 0, 0, SRCCOPY
Return 0
This will prevent falling through to Return DefWindowProc(). A few messages however need to return other values. The MSDN is your best friend when working with the Windows message pipe.
Secondly, some of your actions don't need immediate response from the system and shouldn't break its default behavior. In this case, you shouldn't use SendMessage() in the callback when processing other messages. Use PostMessage() instead and let the current message fall through to DefWindowProc(), i.e. don't use any special Return for it.
The difference between SendMessages() and PostMessage() is that the former blocks the callback until the SendMessage() call is executed in full while the latter proceeds immediately not blocking it. The message you've just posted will be placed in the window message queue and executed in a natural non-blocking manner at some later time.
Here too, you should consult the MSDN to see if the message in question is normally sent or posted. Each message entry there will usually start with something like
An application sends the WM_PAINT message when ...
or
The WM_KEYDOWN message is posted to the window ...
There are only slight differences in how Windows would process sent and posted messages but in very many cases the effect of this difference is exactly what you're after in your code.