From: JRGlide on
I have been struggling for weeks with this very problem. I need to call an
MFC dll from a non-MFC application. The MFC dll was originally a working MFC
appllication that I conveted to a dll. The dll works fine except that it
crashes when I try to exit.

David, you mentioned that you have done this successfully many times. Can
you (or anyone else) show some snippets of code showing how you did this so I
can compare it to mine? Maybe the calling code, the CWinApp (or at least the
InitInstance) and maybe the hook function? I would appreciate it a lot. I
probably have one line that is wrong some place but I'm not sure what it is.

The way I created my dll is to use to App Wizard to create an MFC dll. Then
I simply added my working application code to the dll skeleton code, and then
added a 'C' hook function to the CWinApp that can be called from the outside
to invoke the application.

Thank you for any help you can provide. I have probably been to over 100
sites looking for an answer, plus various forums looking for an example and
haven't found one yet. Although everything I read says it can be done and
should be easy..

Jim