Win32 DLL using the principles of project engineering, can not move, you need to re-create one, so the next record of how the Win32 DLL project, use the code to add MFC support
1. Modify the code stdafx.h
. 1 #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will explicitly 2 . 3 #include <afxwin.h> // the MFC core component and the standard component . 4 #include <afxext.h> // the MFC extension . 5 . 6 #ifndef _AFX_NO_OLE_SUPPORT . 7 #include <AFXOLE.H> // the MFC class of the OLE . 8 #include <afxodlgs.h> // the MFC class of the OLE dialog . 9 #include <Afxdisp.h> // the MFC automation class 10 #endif // _AFX_NO_OLE_SUPPORT . 11 12 is # ifndef _AFX_NO_DB_SUPPORT 13 is #include <AFXDB.H> // the MFC database classes the ODBC 14 #endif // _AFX_NO_DB_SUPPORT 15 16 #ifndef _AFX_NO_DAO_SUPPORT . 17 #include <afxdao.h> // the MFC database classes the DAO 18 is #endif // _AFX_NO_DAO_SUPPORT . 19 20 is #include < afxdtctl.h> // MFC common controls on Internet Explorer 4 support 21 #ifndef _AFX_NO_AFXCMN_SUPPORT 22 #include <afxcmn.h> // MFC support for Windows common controls 23 #endif // _AFX_NO_AFXCMN_SUPPORT
2. Add the code works
1 #ifdef _X86_ 2 extern "C" { int _afxForceUSRDLL; } 3 #else 4 extern "C" { int __afxForceUSRDLL; } 5 #endif
3. Modify project properties
Project - Properties - General -MFC use, select " Use MFC in a static library "
Engineering - Property -C / C ++ - code generation - runtime - select MT or the MTD (determined according to the release or debug)
Project - Properties - Linker - Input - ignore specific default library - afxcwd.lib libcmtd.lib MSVCRTD.LIB
Finally you can use to compile the MFC