IDR_MAINFRAME的含义

来源:互联网 发布:omronplc编程软件 编辑:程序博客网 时间:2024/06/02 12:05

msdn上摘录出来的,没来得及翻译,以后再说

The document string is a string resource formed from a combination of up to seven substrings separated by /n characters, each of which describes one characteristic of the frame window or document associated with the document template. In left-to-right order, the substrings specify:

  • The name that will appear in the frame window's caption bar (SDI applications only). This is usually the name of the application-for example, "Microsoft Draw."
  • The default name assigned to new documents. If this substring is omitted, the default is "Untitled."
  • A descriptive name for the document type that appears along with other document types in a dialog box when the user selects New from the File menu-for example, "Spreadsheet" or "Drawing." This entry is only needed in MDI applications that register two or more document types.
  • A descriptive name for documents of this type combined with the default file name extension-for example, "Draw files (*.DRW)." This string is used in the file-type field of the Open and Save As dialog boxes.
  • The default file name extension for documents of this type-for example, DRW.
  • A name with no spaces that identifies the document type in the registry-for example, "MicrosoftDraw.Document." If an application calls CWinApp::RegisterShellFileTypes to register its document type(s), this substring becomes the default value for the HKEY_CLASSES_ROOT subkey named after the document's file name extension.
  • A descriptive name for the document type-for example, "Microsoft Draw drawing file." Unlike the substring preceding it in the document string, this substring can include spaces. If your application calls CWinApp:: RegisterShellFileTypes to register its document type(s) in the system registry, this substring is the human-readable document type name that the Windows 95 shell displays in property sheets for documents of this type.

You can omit substrings when you create a document string resource; individual substrings may be omitted by following the previous /n character with another /n, and trailing NULL substrings may be omitted altogether. If you build an application with AppWizard, of course, the document string is created for you. The resource statements for a typical SDI document string look like this:

 STRINGTABLEBEGIN    IDR_MAINFRAME "Draw/n/n/nDraw files(*.drw)/n.drw/n        Draw.Document/nDraw Document"END

When this application is started with an empty document, its frame window will have the title "Untitled - Draw." The default file name extension for documents saved by this application is DRW, and DRW will be one of the file name extensions listed in the Open and Save As dialog boxes.

After a document template is created, substrings belonging to the document string can be retrieved with MFC's CDocTemplate::GetDocString function. For example, the statements

 CString strDefExt;pDocTemplate->GetDocString (strDefExt,                            CDocTemplate::filterExt);

copy the document's default file name extension to the CString named strDefExt.

原创粉丝点击