Add MCF support to an existing standard DLL
-
So far I have found these two articles about adding MFC Support to an existing ATL DLL. They are both very similar. http://www.codeproject.com/com/COM_EXE_Server.asp#xx1175657xx[^] http://support.microsoft.com/kb/q173974/[^] Is there a way to add MFC support to an existing, non ATL, DLL?? I really only need just to add a simple dialog with a progress bar and a cancel button but my existing project is making this hard. Is it possible to use WTL somehow? I have never used it before. Thank you!
-
So far I have found these two articles about adding MFC Support to an existing ATL DLL. They are both very similar. http://www.codeproject.com/com/COM_EXE_Server.asp#xx1175657xx[^] http://support.microsoft.com/kb/q173974/[^] Is there a way to add MFC support to an existing, non ATL, DLL?? I really only need just to add a simple dialog with a progress bar and a cancel button but my existing project is making this hard. Is it possible to use WTL somehow? I have never used it before. Thank you!
Yes. Lose the DllMain. Create a object dervied from CWinApp, declare global instance of it. Whatever was done in DLL_PROCESS_ATTACH, do it in CWinApp::InitInstance Whatever was done in DLL_PROCESS_DETACH do it in CWinApp::ExitInstance. Link with appropriate MFC library (static or dynamic). There may be a few other compiler or linker settings to tweak, but that is the gist of it.