各位大侠:
     我已经用MFC建立的工程,并且写了自己的代码(好多),现在想把里面的的数据(一个list)序列化保存为自己的特有格式,怎么办?
     我知道在向导里写了扩展名,是可以办到的。可是现在工程都建立了,如何指定自己的扩展名?

解决方案 »

  1.   

    首先要保证是基于doc/view,然后完成以下操作。
    1.在字符串资源中,ID号为IDR_MAINFRAME的字符串第四个'\n'后面添加.XXX(你所指定的扩展名)
    2.在你的APP文件中,InitInstance中,在AddDocTemplate后面,加上
      EnableShellOpen();
      RegisterShellFileTypes(TRUE);
      

  2.   


    CDocTemplate::windowTitle   Name that appears in the application window's title bar (for example, "Microsoft Excel"). Present only in the document template for SDI applications. CDocTemplate::docName   Root for the default document name (for example, "Sheet"). This root, plus a number, is used for the default name of a new document of this type whenever the user chooses the New command from the File menu (for example, "Sheet1" or "Sheet2"). If not specified, "Untitled" is used as the default. CDocTemplate::fileNewName   Name of this document type. If the application supports more than one type of document, this string is displayed in the File New dialog box (for example, "Worksheet"). If not specified, the document type is inaccessible using the File New command. CDocTemplate::filterName   Description of the document type and a wildcard filter matching documents of this type. This string is displayed in the List Files Of Type drop-down list in the File Open dialog box (for example, "Worksheets (*.xls)"). If not specified, the document type is inaccessible using the File Open command. CDocTemplate::filterExt   Extension for documents of this type (for example, ".xls"). If not specified, the document type is inaccessible using the File Open command. CDocTemplate::regFileTypeId   Identifier for the document type to be stored in the registration database maintained by Windows. This string is for internal use only (for example, "ExcelWorksheet"). If not specified, the document type cannot be registered with the Windows File Manager. CDocTemplate::regFileTypeName   Name of the document type to be stored in the registration database. This string may be displayed in dialog boxes of applications that access the registration database (for example, "Microsoft Excel Worksheet").