最简单的做法,直接使用notepad:
把你需要的输出,存到一个临时txt文件中去(可以使用系统的temp目录),假设你存的是c:\windows\temp\output.txt,使用WinExec("notepad.exe c:\\windows\\temp\\output.txt"); 就可以了.

解决方案 »

  1.   

    我的参数在程序开始时,并不确定。直到Dialog5(第五个对话框!),其中还有用户要输入参数,这些也要输出。所以,问题在于我怎样把这些参数存到txt文件中?
      

  2.   

    当然是在你的程序中动态的创建->操作(读、写)->删除这个临时文件。方法有很多,其中之一是你可以使用CFile。
      

  3.   

    比如:TCHAR szTempPath[MAX_PATH];
    GetTempPath(sizeof(szTempPath) / sizeof(TCHAR), szTempPath); 
    CString strFile = szTempPath + _T("\\output.txt");
    CFile fileOutput(strFile, CFile::modeCreate | CFile::modeReadWrite);
    fileOutput.Write(......);
    fileOutput.Write(......);
    ......CString strCmd;
    strCmd = _T("notepad.exe ");
    strCmd += strFile;
    WinExec(strCmd); 还有,一般这个临时文件不用删除,因为,首先,它位于系统的temp目录;其次,下次你调用同样的code时(CFile fileOutput(strFile, CFile::modeCreate | CFile::modeReadWrite);),会把原来的内容清空。当然,你想在合适的时候把它删除,那也没问题。