Why is CWinAppEx::OnFileNew called automatically?

  • Thread starter Thread starter linganmm
  • Start date Start date
L

linganmm

Guest
I am developing a Visual C++ single document MFC program.

And I just override the default CWinAppEx::OnFileNew method by

void CmyappApp::OnFileNew()
{
CWinAppEx::OnFileNew();
MessageBox(NULL, _T("hello.\n"), _T("Error"), MB_OKCANCEL);
}

Then I find that the method above is called automatically upon executing the program, because I see the Message box immediately after the program window shows up.

Looks the file->new operation is triggered automatically after starting the program.

And if I remove the "CWinAppEx::OnFileNew();" from the override method, the program exits right after started.

Why does this happen? thanks!

Continue reading...
 
Back
Top