Status of MFC

Source: Internet
Author: User

 

MFCMultiple States are defined. Here we will introduce the module status, Process status, and thread status. These statuses can be combined, for exampleMFCThe handle ing is locally valid for the module and thread. It belongs to the module.-A part of the thread status.

Module status

The meaning of the module here is: an executable program or an applicationMFC DLLOfDLLFor exampleOLEA widget is a module.

Each module of an application has a status. The module status includes the following information:WindowsInstance handle, pointing to the currentCWinAppOrCWinThreadObject Pointer,OLEModule reference count,WindowsObjects and correspondingMFCIng between objects. Only the application status of a single module9-1.

M_pModuleStatePointer is a member variable of the thread object, pointing to the current module status information (AFX_MODULE_STATEStructure Variable ). When the program runs into a specific module, you must ensure that the current module status is valid-the module status of this specific module. Therefore, each thread object has a pointer pointing to a valid module state. Every time it enters a module, it must point to the status of a valid module, this is very important for maintaining the global state of the application and the integrity of the state of each module. To achieve this, all entry points of each module are responsible for switching the module status. The module entry points include:DLLOutput Functions;OLE/COMWindow Process.

Process and dynamic link in the presentation windowMFC DLLRulesDLLThe statementAFX_MANAGE_STATE (AfxGetStaticModuleState ())It is used to switch the module status at the entry point. The implementation mechanism will be later9.4.1Section.

Status switches between multiple modules9-2.

Figure9-2Medium,M_pModuleStateAlways point to the status of the current module.

Data Structure of the module, process, and thread status

MFC

Related Article

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.