Hello,

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:
...
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
...

Then I added an message handler in CMainFrame class:
...
ON_COMMAND(ID_FILE_OPEN, &CMainFrame::OnFileOpen)
...
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?

Thanks,
Brian