The basic controls that come with mfc are not very beautiful, so most developers will customize the class to redraw the controls. I have also accumulated a lot of redrawing of controls, such as dialog boxes, static texts, list boxes, and so on.
But it’s troublesome to reimport these classes into a new project every time, and I don’t want to disclose the code I have accumulated, so I thought of encapsulating it into a library file, and I only need to import the header every time. Files and libraries are fine, so that no one else can see the internal implementation.
The following describes how to encapsulate these classes into static link libraries?
1. The new project is MFC DLL
2, DLL type select regular DLL with static link MFC
< p>
3. Import your own custom class, and add the AFX_EXT_CLASS keyword to the header file of the original class
For example, my custom class is as follows:
< p>
Add the keyword AFX_EXT_CLASS, below This is the external header file, which can be directly quoted by other projects.
The project properties need to be changed so that the lib file will be obtained.