In the MSDN index go to "Regular DLL" topic and select "Regular DLLs Dynamically Linked to MFC" subtopic.
When building a regular DLL that dynamically links to MFC, you need to use the macroAFX_MANAGE_STATE to switch the MFC module state correctly. This is done by adding the following line of code to the beginning of functions exported from the DLL:
The AFX_MANAGE_STATE macro should not be used in regular DLLs that statically link to MFC or in extension DLLs. For more information, see Managing the State Data of MFC Modules.
I really went nuts, when I tried to use and popup a DialogWindow in a dll.
Normally I tried to do it simply as I do in an application by:
I went nearly crazy.
All I had to include on top was:
That was all...
Thank you for your help!
IS it possible to use OCX object in MFC created regular DLL ? I checked the main executable program which has "AfxEnableControlContainer();" in InitInstance() .
The dialog box called from dll function still does not show. Please help!!! My both simple dll and exe programs are generated by MFC AppWizard. I can attach my simple program. Thanks for any help!!!
I've tried to add dialogs to my program by this way but I always get "debug assertion failed"-errors when executing DoModal() in debug mode. Some months ago I had a similar problem which could be solved by changing the compiler settings. I've tried this also but it didn't work.
I've read the other comments and it seems to me I'm not alone with this problem. Has anyone a solution for this problem?