I am working on an existing project and noticed some interesting phenomenon. I then created a small project and reproduced this behavior.

When I created a new project, the system provided a default message handler for the file open menu item like this:

Then I added an message handler in CMainFrame class:
void CMainFrame::OnFileOpen()
::AfxMessageBox(_T("Hello Open"));

Now when I click the menu item "File"->"Open", the new added handler in CMainFrame is called.

My question is: How does CWinApp::OnFileOpen() get overridden? How does the framework know CMainFrame::OnFileOpen() should be called in stead of CWinApp::OnFileOpen()?

Another question is: Does MFC support multiple handlers for one message? How do we avoid conflicting behaviors?