CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    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.


  2. #2
    Join Date
    May 1999
    Posts
    4

    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


  3. #3
    Join Date
    Apr 1999
    Location
    India
    Posts
    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
  •  





Click Here to Expand Forum to Full Width

Featured