ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

newatlinterfaces.h
Go to the documentation of this file.
00001 /*
00002  * ReactOS Explorer
00003  *
00004  * Copyright 2009 Andrew Hill <ash77 at domain reactos.org>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 #pragma once
00022 
00023 template<class T>
00024 class IProfferServiceImpl : public IProfferService
00025 {
00026 public:
00027     STDMETHODIMP ProfferService(REFGUID rguidService, IServiceProvider *psp, DWORD *pdwCookie)
00028     {
00029         return E_NOTIMPL;
00030     }
00031 
00032     STDMETHODIMP RevokeService(DWORD dwCookie)
00033     {
00034         return E_NOTIMPL;
00035     }
00036 
00037     HRESULT QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
00038     {
00039         return E_FAIL;
00040     }
00041 };
00042 
00043 /*
00044 This subclass corrects a problem with the ATL IConnectionPointImpl.
00045 IConnectionPointImpl queries for the exact interface that is published, but at least one
00046 implementor of IConnectionPoint (CShellBrowser) advertises DIID_DWebBrowserEvents,
00047 but fires events to IDispatch.
00048 */
00049 template<class T, const IID *piid, class CDV = CComDynamicUnkArray>
00050 class MyIConnectionPointImpl : public IConnectionPointImpl<T, piid, CDV>
00051 {
00052 public:
00053     STDMETHODIMP Advise(IUnknown *pUnkSink, DWORD *pdwCookie)
00054     {
00055         IConnectionPointImpl<T, piid, CDV>  *pThisCPImpl;
00056         T                                   *pThis;
00057         IUnknown                            *adviseSink;
00058         DWORD                               newCookie;
00059         HRESULT                             hResult;
00060 
00061         pThis = static_cast<T *>(this);
00062         pThisCPImpl = static_cast<IConnectionPointImpl<T, piid, CDV> *>(this);
00063         if (pdwCookie != NULL)
00064             *pdwCookie = 0;
00065         if (pUnkSink == NULL || pdwCookie == NULL)
00066             return E_POINTER;
00067         hResult = pUnkSink->QueryInterface(IID_IDispatch, (void **)&adviseSink);
00068         if (FAILED(hResult))
00069         {
00070             if (hResult == E_NOINTERFACE)
00071                 return CONNECT_E_CANNOTCONNECT;
00072             return hResult;
00073         }
00074         pThis->Lock();
00075         newCookie = pThisCPImpl->m_vec.Add(adviseSink);
00076         pThis->Unlock();
00077         *pdwCookie = newCookie;
00078         if (newCookie != 0)
00079             hResult = S_OK;
00080         else
00081         {
00082             adviseSink->Release();
00083             hResult = CONNECT_E_ADVISELIMIT;
00084         }
00085         return hResult;
00086     }
00087 };

Generated on Sun May 27 2012 04:22:55 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.