4 * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 class IProfferServiceImpl
: public IProfferService
27 STDMETHODIMP
ProfferService(REFGUID rguidService
, IServiceProvider
*psp
, DWORD
*pdwCookie
)
32 STDMETHODIMP
RevokeService(DWORD dwCookie
)
37 HRESULT
QueryService(REFGUID guidService
, REFIID riid
, void **ppvObject
)
44 This subclass corrects a problem with the ATL IConnectionPointImpl.
45 IConnectionPointImpl queries for the exact interface that is published, but at least one
46 implementor of IConnectionPoint (CShellBrowser) advertises DIID_DWebBrowserEvents,
47 but fires events to IDispatch.
49 template<class T
, const IID
*piid
, class CDV
= CComDynamicUnkArray
>
50 class MyIConnectionPointImpl
: public IConnectionPointImpl
<T
, piid
, CDV
>
53 STDMETHODIMP
Advise(IUnknown
*pUnkSink
, DWORD
*pdwCookie
)
55 IConnectionPointImpl
<T
, piid
, CDV
> *pThisCPImpl
;
61 pThis
= static_cast<T
*>(this);
62 pThisCPImpl
= static_cast<IConnectionPointImpl
<T
, piid
, CDV
> *>(this);
63 if (pdwCookie
!= NULL
)
65 if (pUnkSink
== NULL
|| pdwCookie
== NULL
)
67 hResult
= pUnkSink
->QueryInterface(IID_IDispatch
, (void **)&adviseSink
);
70 if (hResult
== E_NOINTERFACE
)
71 return CONNECT_E_CANNOTCONNECT
;
75 newCookie
= pThisCPImpl
->m_vec
.Add(adviseSink
);
77 *pdwCookie
= newCookie
;
82 adviseSink
->Release();
83 hResult
= CONNECT_E_ADVISELIMIT
;