Handling window messages using MFC

Started by
3 comments, last by Spartacus 22 years, 8 months ago
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

Real programmers don't document, if it was hard to write it should be hard to understand

Advertisement
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
baumep
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=~
"Journies Lead to Knowledge and Passion Lights the Way..."~=NeuroMorphus=~
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=~
"Journies Lead to Knowledge and Passion Lights the Way..."~=NeuroMorphus=~
Obviously the voice of reason and experience there. MFC sucks indeed. Ever used it buddy? Or did you just try for 3 seconds and give up?

This topic is closed to new replies.

Advertisement