CWinApp::OnFileNew
实现 ID_FILE_NEW 命令。
afx_msg void OnFileNew( );
备注
必须将 ON_COMMAND( ID_FILE_NEW, OnFileNew ) 语句添加到您的 CWinApp 选件类消息映射启用此成员函数。如果启用,文件新的命令此函数处理执行。
请参见 技术说明22 有关默认行为和指南的有关如何重写该成员函数。
示例
// The following message map, produced by the Application Wizard, binds
// the File New, Open, and Print Setup menu commands to default
// framework implementations of these commands.
BEGIN_MESSAGE_MAP(CStdApp, CWinApp)
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
// The following message map illustrates how to rebind the
// File New, Open and Print Setup menu commands to handlers that
// you implement in your CWinApp-derived class.
// Note, you can name the handler CCustomApp::OnFileNew instead of
// CCustomApp::OnMyFileNew, and likewise for the other handlers, if desired.
BEGIN_MESSAGE_MAP(CCustomApp, CWinApp)
ON_COMMAND(ID_FILE_NEW, &CCustomApp::OnMyFileNew)
ON_COMMAND(ID_FILE_OPEN, &CCustomApp::OnMyFileOpen)
ON_COMMAND(ID_FILE_PRINT_SETUP, &CCustomApp::OnMyFilePrintSetup)
END_MESSAGE_MAP()
要求
Header: afxwin.h