我需要在主框架中发出新建文档的消息。这个消息名是什么?

解决方案 »

  1.   

    可以在文档类中响应OnnewFile之类的。
      

  2.   

    参考APPUI2.cpp中的:
    BOOL CWinApp::ProcessShellCommand(CCommandLineInfo& rCmdInfo)
    {
    BOOL bResult = TRUE;
    switch (rCmdInfo.m_nShellCommand)
    {
    case CCommandLineInfo::FileNew:
    //新建文档使用的是OnCmdMsg(ID_FILE_NEW, 0, NULL, NULL)
    if (!AfxGetApp()->OnCmdMsg(ID_FILE_NEW, 0, NULL, NULL))
    OnFileNew();
    if (m_pMainWnd == NULL)
    bResult = FALSE;
    break; // If we've been asked to open a file, call OpenDocumentFile() case CCommandLineInfo::FileOpen:
    if (!OpenDocumentFile(rCmdInfo.m_strFileName))
    bResult = FALSE;
    break;

    }
      

  3.   

    OnNewFile才是最正确的方法,呵呵
      

  4.   

    上面的源代码就是想告诉你SDI程序自身也是通过调用其他函数实现的新建,并不是直接给文档发送消息的!文档是一个无界面窗口的类,它不能直接接收消息,它只能提供处理消息的处理函数!