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
21 #ifndef _newatlinteraces_h
22 #define _newatlinteraces_h
25 class IProfferServiceImpl
: public IProfferService
28 STDMETHODIMP
ProfferService(REFGUID rguidService
, IServiceProvider
*psp
, DWORD
*pdwCookie
)
33 STDMETHODIMP
RevokeService(DWORD dwCookie
)
38 HRESULT
QueryService(REFGUID guidService
, REFIID riid
, void **ppvObject
)
45 This subclass corrects a problem with the ATL IConnectionPointImpl.
46 IConnectionPointImpl queries for the exact interface that is published, but at least one
47 implementor of IConnectionPoint (CShellBrowser) advertises DIID_DWebBrowserEvents,
48 but fires events to IDispatch.
50 template<class T
, const IID
*piid
, class CDV
= CComDynamicUnkArray
>
51 class MyIConnectionPointImpl
: public IConnectionPointImpl
<T
, piid
, CDV
>
54 STDMETHODIMP
Advise(IUnknown
*pUnkSink
, DWORD
*pdwCookie
)
56 IConnectionPointImpl
<T
, piid
, CDV
> *pThisCPImpl
;
62 pThis
= static_cast<T
*>(this);
63 pThisCPImpl
= static_cast<IConnectionPointImpl
<T
, piid
, CDV
> *>(this);
64 if (pdwCookie
!= NULL
)
66 if (pUnkSink
== NULL
|| pdwCookie
== NULL
)
68 hResult
= pUnkSink
->QueryInterface(IID_IDispatch
, (void **)&adviseSink
);
71 if (hResult
== E_NOINTERFACE
)
72 return CONNECT_E_CANNOTCONNECT
;
76 newCookie
= pThisCPImpl
->m_vec
.Add(adviseSink
);
78 *pdwCookie
= newCookie
;
83 adviseSink
->Release();
84 hResult
= CONNECT_E_ADVISELIMIT
;
90 #endif // _newatlinteraces_h