VC Application Framework

Source: Internet
Author: User
Tags what interface

The VC application Framework provides powerful functionality that provides great convenience for our development, making it easy to build the framework of your application. Many common features, such as the creation of documents, the opening of files, Most of the code for saving, and so on, is done by the application framework. These operations are transparent to the users who develop the software. Microsoft designed Visual C + + in the original intention is to provide users with as simple as possible interface, but it is because of the transparency of the application framework, so that the VC's running process is very mysterious, when involved in these VC has provided functional modules of software development, users (especially those who have just contacted VC) Do not know when to use what interface functions, want to change the VC some of the default operations do not know where to start.

We can follow the application framework code with the powerful debug debugging tools from VC, and get some of the process of application framework operations. The implementation is to build the application framework code using the Visual C + + Application Builder to start ClassWizard, Add the interface function you want to trace in each class, edit the interface functions, set breakpoints, and then start debug to step through debugging. Using this method, we can also follow the example code provided by VC. In the process of tracking, VC core code is prohibited to track debugging, we just skip on the line.

The following is based on some of the information I have seen and the document creation of multiple document applications, file Open, save (Save As) operation of the tracking results, single document application and multiple document application of the operation process is basically similar, only with the CSingleDocTemplate class of the same name function to replace the A call to a function with the same name as the CMultiDocTemplate class.

I. Creating a document

On_command (id_file_new,cwinapp::onfilenew)

Entrance: cwinapp::onfilenew

The default implementation of CWinApp for OnFileNew is called: cdocmanager::onfilenew ()

1. Judge if there is no document template, no function return;

2. Determine if there are multiple document templates, if any, start the Document Template selection dialog box, let the user select a template, return the template pointer.

3. Access to Cmultidoctemplate::opendocumentfile by template pointer ()

3.1 Creating a new Document object

3.2 Create a child frame corresponding to a new Document object, and construct a relationship between the child frame, document, and window

3.3 Calling the application's OnNewDocument ()

A. Call Cdocument::onnewdocument ()

Call the application's deletecontents ();

B. User code

3.4 Call InitialUpdateFrame () display window

3.5 Return Document Pointer

4. Returns

Two. Open the document

On_command (Id_file_open,cwinapp::onfileopen)

Entrance: Cwinapp::onfileopen

The default implementation of CWinApp for OnFileOpen is called: Cdocmanager::onfileopen ()

1. Pop-up dialog box allows the user to select the file to open, return the full path name of the file, for the following function call to use.

2. Invoke the application's OpenDocumentFile (LPCTSTR lpszfilename)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.