CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2002
    Posts
    18

    Help me please : write MFC-DLL

    - I built a MFC-DLL with VC++6.0

    I add very simple function : Hello :

    void Hello()
    {

    CFileDialog dlg(0);
    dlg.Domodal();
    }

    and I export this function in .DEF file


    - I use this DLL in VB6
    An error occur :

    ...
    File : afxwin1.inl
    Line : 19
    ...

    I look afxwin1.inl, line 19 :

    Line 18 : _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
    Line 19 : { ASSERT(afxCurrentInstanceHandle != NULL);
    Line 20 : return afxCurrentInstanceHandle; }

    Why that?
    don't my dlg have Parent Handle?

    What will i do to show that Dialog in VB?
    (I must built MFC DLL, not use ATL)

    Please show me
    Thank !
    Last edited by lad; October 17th, 2002 at 08:34 AM.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543
    The problem is that program tries to find dialog template in
    caller exe resource and not in dll resource. See details in MSDN
    topic AFX_MANAGE_STATE.

  3. #3
    Join Date
    Mar 2002
    Posts
    18
    But when I add this line into top of function :

    AFX_MANAGE_STATE(AfxGetStaticModuleState());

    Then Compiler error :

    mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in DLL_TESt2.obj
    mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in DLL_TESt2.obj

    I don't understand why
    How can I do?

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