我想写个控制台的小程序,想在其中用MFC的类如CFile类和CString类.
我要如和做???
谢谢!

解决方案 »

  1.   

    我的意思是创建了一个空的控制台工程,在其中要用CString类和CFile类.
      

  2.   

    #define VC_EXTRALEAN    // Exclude rarely-used stuff from Windows headers
    #include <afxwin.h>        // MFC core and standard components
    #include <afxext.h>        // MFC extensions
    #include <afxdisp.h>        // MFC Automation classes
    #include <afxdtctl.h>        // MFC support for Internet Explorer 4 Common Controls
    #ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h>    // MFC support for Windows Common Controls
    #endif // _AFX_NO_AFXCMN_SUPPORT
    //为了实现支持MFC,必须写上上面这些东西
    #include <string>
    using namespace std;
    //注意:编译这个程序的时候请使用 MFC类库支持。
      

  3.   

    #define VC_EXTRALEAN    // Exclude rarely-used stuff from Windows headers
    #include <afxwin.h>        // MFC core and standard components
    #include <afxext.h>        // MFC extensions
    #include <afxdisp.h>        // MFC Automation classes
    #include <afxdtctl.h>        // MFC support for Internet Explorer 4 Common Controls
    #ifndef _AFX_NO_AFXCMN_SUPPORT
    #include <afxcmn.h>    // MFC support for Windows Common Controls
    #endif // _AFX_NO_AFXCMN_SUPPORT
    //为了实现支持MFC,必须写上上面这些东西
    //注意:编译这个程序的时候请使用 MFC类库支持。
    //现在你就可以在控制台程序中使用CString和CFile了。