Archived

This topic is now archived and is closed to further replies.

Handling window messages using MFC

This topic is 5975 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I just started learning MFC and I have already created some small useless applications. But there''s something I dont understand. Since all the classes (CView, CFrameWnd...etc) have the capability to handle window messages why would I prefer WM_PAINT to be handled by for instance CView instead of CFrameWnd? Is this because the CView class has some functionality which is good for handling that message? And CFrameWnd has functionality that''s good for handling other other messages? -Thanks

Share this post


Link to post
Share on other sites
The reason for that is that a CFrameWnd can contain more than one CView (e.g. splitter windows, control bars). If you''re handling the WM_PAINT message in the CFrameWnd you would overwrite/overdraw the content of the views. If you have only one view it really doesn''t matter that much but it isn''t "clean". (Try to think of the CFrameWnd as the border around or as a container for your view(s) that has nothing to do with the content being displayed within its borders)

baumep

Share this post


Link to post
Share on other sites
Listen, this is very very important. MFC SUCKS!!! Goto: http://www.wxWindows.org, and it will change your life forever...trust me on this one.

"Journies Lead to Knowledge and Passion Lights the Way..."

~=NeuroMorphus=~

Share this post


Link to post
Share on other sites
Listen, this is very very important. MFC SUCKS!!! Goto: http://www.wxWindows.org, and it will change your life forever...trust me on this one.

"Journies Lead to Knowledge and Passion Lights the Way..."

~=NeuroMorphus=~

Share this post


Link to post
Share on other sites