Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Win7
Hi,
 
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);
1.
HRESULT DispEventAdvise(_Inout_ IUnknown* pUnk)
    {
        return _IDispEvent::DispEventAdvise(pUnk, pdiid);
    }
2.
HRESULT DispEventAdvise(
        _Inout_ IUnknown* pUnk,
        _In_ const IID* piid)
    {
        ATLENSURE(m_dwEventCookie == 0xFEFEFEFE);
        return AtlAdvise(pUnk, (IUnknown*)this, *piid, &m_dwEventCookie);
    }
3.
ATLINLINE ATLAPI AtlAdvise(
    _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 5:21am
Edited 14-May-12 5:26am
(no name)498.5K
v2

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

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 Richard MacCutchan 145
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,712
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 14 May 2012
Copyright © CodeProject, 1999-2014
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