程序是单文档。谢谢

解决方案 »

  1.   

    你试一下,我这里没有VC,不能测试。
    CMainFrame::OnClose()
    {
       CDocument* pDoc=GetActiveDocument();
       CString path=pDoc->GetPathName();
       CWinApp* pApp = AfxGetApp();
       pApp->WriteProfileString("My Section","File Path",path);
       …………
    }
    CxxApp::InitInstance()
    {
        CString path=GetProfileString("My Section","File Path",);
        …………
        CCommandLineInfo cmdInfo;
        ParseCommandLine(cmdInfo);
        cmdInfo.m_nShellCommand==CCommandLineInfo::FileOpen;
        cmdInfo.m_strFileName=path;
        if (!ProcessShellCommand(cmdInfo))
          return FALSE;
        …………
    }