Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
4.33/5 (3 votes)
See more:
Hi all.
I'm new to the forum, new to C++ and new to windows raw programming, through win 32. I would like to know what is the best way to handle child window messages: is it any how less efficient to register individual child window proc so that i can encapsulate the whole handler in a package? Or is it better to do a little work around and add a switch to the registered parent window proc and call each child message handler?
Posted

I feel that having a separate procedure function for each window is best in case you might want to do something specific. Sending a message to the parent window can be done if you have some logic which requires the Parent and the child window to work together. You can have a common Window procedure if you just handle the usual messages like WM_CREATE and WM_PAINT.

This is just my opinion and I feel that others might have more information on this. Hope this helped.
 
Share this answer
 
It depends on how much common behaviour there is between the two but personally, I think it's best if the child has it's own WinProc as this means that you can re-use the child window class again with a different parent class, it also makes it much more readable.

Implement messages that it sends it's parent if it requires the parent to do stuff because this way you have far more readable and reusable code in the parent as well.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900