Click here to Skip to main content
13,090,930 members (47,386 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I have an add-in project which creates toolbar written by vs 2005, now when I convert it into 2010 it doesn't work. It returns CONNECT_E_NOCONNECTION when I call DispEventAdvise() function. Could You help me?

Here is the steps of debugging :
CComQIPtr<iunknown,> spUnk(m_pButton);
hr = CCommandButt1Events::DispEventAdvise(spUnk);

HRESULT DispEventAdvise(_Inout_ IUnknown* pUnk)
        return _IDispEvent::DispEventAdvise(pUnk, pdiid);

HRESULT DispEventAdvise(
        _Inout_ IUnknown* pUnk,
        _In_ const IID* piid)
        ATLENSURE(m_dwEventCookie == 0xFEFEFEFE);
        return AtlAdvise(pUnk, (IUnknown*)this, *piid, &m_dwEventCookie);

    _Inout_ IUnknown* pUnkCP,
    _Inout_opt_ IUnknown* pUnk,
    _In_ const IID& iid,
    _Out_ LPDWORD pdw)
    if(pUnkCP == NULL)
        return E_INVALIDARG;
    CComPtr<iconnectionpointcontainer> pCPC;
    CComPtr<iconnectionpoint> pCP;
    HRESULT hRes = pUnkCP->QueryInterface(__uuidof(IConnectionPointContainer), (void**)&pCPC);
    if (SUCCEEDED(hRes))
        hRes = pCPC->FindConnectionPoint(iid, &pCP);
    if (SUCCEEDED(hRes))
        hRes = pCP->Advise(pUnk, pdw);
    return hRes;

The call of hRes = pCPC->FindConnectionPoint(iid, &pCP) function returns CONNECT_E_NOCONNECTION value.
Posted 14-May-12 4:21am
Updated 14-May-12 4:26am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 14 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100