Windows Message procedure


I’m beginning programmation under windows and i don’t really understand the windows message procedure. I wrote a programm where there is several windows. Can I have several message procedure? If so, how i use the main Loop?



Yes, each type of window can and probably should have its own message procedure. If they are the same type, they should use the same. Messages are first routed to the window owning the message so to speak. If it doesn’t handle it, it goes up to the next level for handling, and so on until it goes up to the system and it will usually ignore it and removes it. The main loop does not need to be changed, usually, though you could use PeekMessage instead of GetMessage, but it depends on your needs. And, you can add code in the while loop for processing to be done outside of the windows messaging loop.

Thank’s for your answer shinpaughp.