Debug Assertion on ActiveX Create
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Debug Assertion on ActiveX Create

  1. #1
    Join Date
    May 2005
    Posts
    45

    Debug Assertion on ActiveX Create

    Hello,

    I have a MFC Com Dll that has a CDialog. In the OnCreate event I create an ActiveX control. The dll is hosted inside an executable of mine. In this scenario everything works fine!

    The dll is also called from an external executable and then a Debug Assertion in OCCSITE.cpp occurs when I create the ActiveX control. I suspect that in the executable there is no AfxOleInit. I spend some time with this problem and tried to CoInitialize, OleInitialize, AfxOleInitModule and even AfxOleInit in the dll. But all that does not change a thing. If I understand the mechanics then this is an intended behaviour and should be done in the host exe.

    What I observed in the OCCSITE.cpp:

    Code:
    _AFX_THREAD_STATE* pState = AfxGetThreadState();
    if (!pState->m_bNeedTerm && !AfxOleInit())
    	return hr;
    In my executable m_bNeedTerm is 0 and in the external one (where the ActiveX does not work) it is -1. In AfxOleInit this is explained as a special flag to prevent the dll from doing an unnecessary OleInitialize. But as I said even if I call OleInitialize myself I get the Debug Assertion and the ActiveX is not visible.

    Is there anything I can do to make the ActiveX control work in the external application? Obviously I cannot Change anything in the application...

    Thank you!!

    Robin

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,049

    Re: Debug Assertion on ActiveX Create

    You should provide a minimal compilable project that replicates your issue.
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center