MFC made with the interface DLL and call

1, make the interface DLL with MFC

1) New MFC DLL project, the project name "MyDLL", to create a new solution, the solution name is "MFCDLL".

2) Right-click on the project, add MFC class. Enter the class name: My_Dlg, select the base class: CDialog, click Finish.

3) Add the exported dll macro definitions in the mail Project -> Add DLLEXPORY pre-defined processor -> Properties -> C / C ++ -> Preprocessor 

Add DLL_EXPORY to be exported before the class, the class as a class everywhere

4) define a derived function, which returns a pointer to the derived class interface base. In My_Dlg.cpp write export interface:

Generate MyDLL.dll. MFC DLL program created.


2, the new MFC application, entitled CTestDllDemoDlg, using dynamically invoke the dynamic library, the following steps:

 

1) Add the header file

#include "../MyDll/My_Dlg.h"

2) right click -> Properties -> Linker -> Input -> Additional Dependencies added lib file

3) dynamic call dll. Note the location of the dll

Source Address:

https://download.csdn.net/download/u011370855/10678827

Guess you like

Origin blog.csdn.net/u011370855/article/details/82798091