|
-
May 12th, 1999, 06:52 AM
#1
Dialog box display from dll
Can anyone help.
How to display a dialog box and handle its message from a dll using MFC.
Thank for your time.
-
May 12th, 1999, 07:17 AM
#2
Re: Dialog box display from dll
I hope that I understood your problem correct.
Once I had the problem that my DialogBox was not shown by using DoModal();
In my case it was a Setting of the project.
=> use Use MFC in a Static Library
instead of Use MFC in a Shared DLL
-
May 12th, 1999, 08:25 AM
#3
Re: Dialog box display from dll
Actually what I understood from your question is,you are trying to export a dialog box from a extension dll and you want that dialog box to be called from ur application.
If what u meant is the above, then try to export your dialog class using AFX_EXT_CLASS.And create a global function which will return a pointer to a object of that dialog calss.In that function create an object and return the pointer.
Like this..
class AFX_EXT_CLASS a: CDialog
{
//All member functions should be virtual
}
extern "C" __declspec(dllexport) a* CreateObjA(void)
{
return new a();
}
and in the calling app.
define like this
typedef a* (*fnpCreateDlg)(void);
try to load the dll,and get the function address using GetProcAddress of CreateObjA.
fnpCreateDlg fCreateA = (fnpCreateDlg) GetProcAddress(hDllHandle,"CreateObjA");
a *Dlga= (*fCreateA)();
Dlga->DoModal();
try this...It works for me..
PS: Don't forget to use
AfxGetResourceHandle &
AfxSetResourceHandle
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|