Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

Set/Get the Title, Caption of the Application's Main Frame

VC++ (MFC) Tips :     Application Object


 Set the Title, Caption of the Application's Main Frame

 

      The string resource consists of up to seven substrings separated by the '\n' character (the '\n' character is needed as a placeholder if a substring is not included; however, trailing '\n' characters are not necessary); these substrings describe the document type.

 

   1. CDocTemplate::windowTitle       //Application name ("Ms Excel")
   2. 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.
   3. 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.
   4. CDocTemplate::filterName             //Description of filter name ("Worksheets (*.xls)")
   5. CDocTemplate::filterExt                   //Filter name (".xls")
   6. 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.
   7. CDocTemplate::regFileTypeName           //File Type in windows file manager or explorer

 

   For example:

IDR_MAINFRAME      "MyAPP  Windows   Application\nSheet\nWorksheet\n Worksheets (*.mya)\n.mya\nMyAppSheet\n MyApp Worksheet"

 

 

Get the Title, Caption of the Application's Main Frame

   Key functions:    GetDocTemplate(), GetDocString()

 

   For example:

// This example accesses the doc template object to construct
// a default document name such as SHEET.XLS, where "sheet"
// is the base document name and ".xls" is the file extension
// for the document type.
CMyDrawDoc * pDoc = GetDocument();    //Ignore this line if in CDocument class
CString strDefaultDocName, strBaseName, strExt;
CDocTemplate* pDocTemplate = pDoc->GetDocTemplate();
if (!pDocTemplate->GetDocString(strBaseName, CDocTemplate::docName)   || !pDocTemplate->GetDocString(strExt, CDocTemplate::filterExt))
{
   AfxThrowUserException(); // These doc template strings will
   // be available if you created the application using AppWizard
   // and specified the file extension as an option for
   // the document class produced by AppWizard.
}
strDefaultDocName = strBaseName + strExt;


Copyright (c) 1999 - 2001, robert han, all rigths are reserved.