locked
Can't debug my ATL-OCX application RRS feed

  • Question

  • Hello

    I have a legacy C++ application, with the following configuration:

    1. Its a COM server, without MFC, with ATL

    2. Implements CFrameWindowImpl<>

    3. Which contains CWindowImpl<>

    4. Which contains a third party OCX

    Everything works fine if I build in release or debug, but when I try to use the debugger to trace the execution I keep getting an exception. The COLEException occurs here:

    hRes = poaxWindowP->CreateControlEx(bstrURL,NULL,NULL,&pitfUnknownPtrP,__uuidof(IUnknown));

    In here:

    HRESULT ActivateAx( 

      CComQIPtr<IOleClientSite> spClientSite(GetControllingUnknown());
      m_spOleObject->SetClientSite(spClientSite);

    So the debugger is useless. Any help would be appreciated.


    Guy Harel

    Thursday, April 25, 2013 5:26 PM

Answers

  • Found a trick. In VS menu Debug/Exceptions, I have added "COleExeption" and unchecked it. Now I can use the debugger.


    Guy Harel

    • Proposed as answer by i1friend Tuesday, April 30, 2013 6:22 AM
    • Marked as answer by Elegentin Xie Tuesday, April 30, 2013 9:33 AM
    Friday, April 26, 2013 2:07 PM

All replies

  • What is the COLEException ?

    Reply, then visible.

    Friday, April 26, 2013 10:03 AM
  • I tried to catch the COleException but the project is ATL and including <afxdisp.h> just wont compile. There is an OleException during ActivateAx() SetClientSite():

    if (m_dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)
    {
      CComQIPtr<IOleClientSite> spClientSite(GetControllingUnknown());
      m_spOleObject->SetClientSite(spClientSite); <- COleException
    }
    According to a post the OCX is looking for "ambient" properties and cannot find them?

    Guy Harel

    Friday, April 26, 2013 1:39 PM
  • Found a trick. In VS menu Debug/Exceptions, I have added "COleExeption" and unchecked it. Now I can use the debugger.


    Guy Harel

    • Proposed as answer by i1friend Tuesday, April 30, 2013 6:22 AM
    • Marked as answer by Elegentin Xie Tuesday, April 30, 2013 9:33 AM
    Friday, April 26, 2013 2:07 PM