MFC extension DLL for VC ++ dynamic link library Programming

Source: Internet
Author: User

MFC extension DLL for VC ++ dynamic link library Programming

The similarities between the MFC extension DLL and the MFC rule DLL are that the MFC class library can be used inside the two DLL types. The difference is that the interface between the MFC extension DLL and the application can be MFC. MFC extension DLL refers to the extension of MFC. Its main function is to generate reusable classes from existing MFC library classes. The MFC extension DLL uses the MFC Dynamic Link Library version. Therefore, only the MFC executable files (application programs or rule DLL) generated using the shared MFC version can use the MFC extension DLL.

Previously, we can see that the MFC rule DLL is automatically added to a CWinApp object by the MFC wizard, while the MFC extension DLL does not include this object, but is automatically added to the DllMain function. For the MFC extension DLL, the developer must add the initialization and end code in the DLL DllMain function.

From the following table, we can see that the three DLL methods are different for the DllMain entry function:

DLL type entry function

Non-mfc dll programmers provide DllMain Functions

MFC rule DLL CWinApp object InitInstance and ExitInstance

MFC extension dll mfc dll Wizard to generate the DllMain Function

For the MFC extension DLL, the system automatically adds the macros shown in the following table to the project, which facilitates the compilation of the DLL and application programs. Macros such as AFX_EXT_CLASS, AFX_EXT_API, and AFX_EXT_DATA have different definitions in DLL and application, depending on whether the _ AFXEXT macro is defined. This allows the use of a unified macro In the DLL and Application to express the different meanings of output and input. In DLL, it indicates the output (because _ AFXEXT is defined, it is usually specified in the identifier parameter of the compiler); in the application, it indicates the input (_ AFXEXT is not defined ).

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.