CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    10

    dialogs in dlls?

    I'm creating a dll for a Visual Basic program.
    It works fine when I just put a messagebox and run
    it because it shows up in the vb program but
    when i try to load the dialog I created it doesnt show up
    I'm not sure if I'm doing it correctly
    ( using VC++ 6.0) and created a mfc dll project
    that supports both win32 and mfc.
    Any ideas?

    Here is the code that loads the dialog:

    extern "C" int WINAPI dlg();

    extern "C" int WINAPI dlg()
    {
    CTest testDlg;

    testDlg.DoModal();
    testDlg.ShowWindow( SW_SHOW);
    return MessageBox( NULL, "SDFSDF", "SDFDSSD", MB_OK );
    }

    CTest is a c++ class created using classwizard





  2. #2
    Join Date
    May 1999
    Posts
    116

    Re: dialogs in dlls?

    Unless your dll is an MFC Extention Dll you will need to explicitly set the resource handle so that the MFC will look for the dialog resource in your dll as opposed to the calling application.

    Try this:

    CTest testDlg;

    HINSTANCE hOldRsrcInst = AfxGetResourceHandle();
    AfxSetResourceHandle(theApp.m_hInstance);

    testDlg.DoModal();

    if ( hOldRsrcInst )
    AfxSetResourceHandle(hOldRsrcInst);






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