Re: Show Dialog from MFC Extension DLL
"Leo Violette" <nineballer@comcast.net> wrote in message
news:2F1F182B-7983-4A39-AD5C-84CD475818DA@microsoft.com...
I actually like using a regular DLL as it allows my dialog to be displayed
and used by both MFC applications as well as non-MFC applications.
I simplify things by exporting a non-MFC class that "represents" my
dialog. I add a DoModal (or ShowDialog) method to this class.
In the .cpp file, I #include the header file that contains the real dialog
declaration. And in the implementation of my DoModal, I call
AFX_MANAGE_STATE, then create the dialog object and call DoModal on it.
This way, the user of the DLL only sees the header
file that has no MFC in it, so they aren't exposed to it (this is what
allows ATL and console applications to use the DLL to show the dialog).
This works well for shared dialogs and also allows me to add other methods
to the exported class, like setting up inital values that I will
pass to the real dialog class. This has worked quite well for me in the
vast majority of situations and I've had no worries about sharing
resource ID's that come up with extension DLLs.
Yes, it sounds like this is a good solution for you. My DLL contains many
exported classes, none of which have anything to do with resources, so
thanks to Ajay for saying I don't need to call AFX_MANAGE_STATE even if it
is a Regular MFC DLL.
-- David