Click to See Complete Forum and Search --> : Dialog doesn't show in explicitly loaded dll


danik
April 11th, 1999, 04:48 PM
Hi,

I have a control panel applet that shows a dialog by calling an exported function with a LoadLibrary and GetProcAddress. This "C" externed function resides in a dll that is dynamicaly linked to MFC. The control panel applet is a simple win32 dll.
As the documentation reads, I am calling "AFX_MANAGE_STATE(AfxGetStaticModuleState());" at the begining of the function.

The _DEBUG version works fine. The release does not.

In the release version, the dialog never show up. The return value from DoModal is IDABORT.

Any ideas?

TIA

friendsp
November 1st, 2001, 10:36 AM
Hi, guy, showing Dialog(linked with a resource) in DLL is a little tricky.
you can change project-settings to achieve this. I developed a MFC DLL with a Dialog resource, and I created a CMyDialog (subclass of CDialog) with that resource. the DLL also export an "extern "C" function. In that function I create an instance CMyDialog dlg; and called dlg.domodal().
At first, it cannnot work, which I thought quite similar to your problem.
The solution is to change project-settings.
I make the DLL 'statically' linked to MFC, and all problems settled.

any questions email to friendsp@yahoo.com
development discussion are all welcomed.