Reputation: 9262
I want to add a dialog box to a c++ dll application. First of all I would like to know if this is possible and afterwards how can I do the project compile.
When I set in the configurations "using MFC standard library" I receive the error: fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
When I set the configuration using MFC in a shared dll file I receive the error: general error c101008a: Failed to save the updated manifest to the file ".\Debug\RenameDLL.dll.embed.manifest" false parameter.
Any suggestion how to tackle this? I make also use of windows.h library.
Upvotes: 0
Views: 1946
Reputation: 36
I know this is old as this is gold for the intrepid. Yes it is possible, perhaps a little trickier on recent VS C++. What you need is a "MFC Extension DLL". Just select this "extension mode" when creating your DLL using the Visual Studio wizard.
If you create (or adapt from a project) a regular MFC DLL you won't be able to create CDialogs when using recent VS C++, i.e. VS C++ 2015. It will work on VS C++ 6.0 tho.
Upvotes: 0
Reputation: 10756
Yes, it's definately possible, and "Use MFC in a Shared DLL" is the one you want.
If you have precompiled headers switched on, you'll have a stdafx.h
in your project which should contain various #include <afx...>
These are the required MFC headers to include.
Your second error I suspect will go away with a Rebuild All
.
Another problem you may or may not get is that nothing happens after calling DoModal()
on your dialog instance. In that case place AFX_MANAGE_STATE(AfxGetStaticModuleState())
before the DoModal()
Upvotes: 1
Reputation: 18451
Upvotes: 0