home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / atltangram / atlmodel / cpatlmodel.h < prev    next >
C/C++ Source or Header  |  1998-03-26  |  1KB  |  41 lines

  1. // CpAtlModel.h: Declaration of CProxyIATLTangramModelEvent
  2. //
  3. // This is a part of the Active Template Library.
  4. // Copyright (C) 1996-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Active Template Library Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Active Template Library product.
  12.  
  13. //////////////////////////////////////////////////////////////////////////////
  14. // CProxyIATLTangramModelEvent
  15. template <class T>
  16. class CProxyIATLTangramModelEvent : public IConnectionPointImpl<T, &IID_IATLTangramModelEvent, CComDynamicUnkArray>
  17. {
  18. public:
  19.  
  20. //IATLTangramModelEvent : IUnknown
  21. public:
  22.     HRESULT Fire_OnModelChange()
  23.     {
  24.         T* pT = (T*)this;
  25.         pT->Lock();
  26.         HRESULT ret;
  27.         IUnknown** pp = m_vec.begin();
  28.         while (pp < m_vec.end())
  29.         {
  30.             if (*pp != NULL)
  31.             {
  32.                 IATLTangramModelEvent* pIATLTangramModelEvent = reinterpret_cast<IATLTangramModelEvent*>(*pp);
  33.                 ret = pIATLTangramModelEvent->OnModelChange();
  34.             }
  35.             pp++;
  36.         }
  37.         pT->Unlock();
  38.         return ret;
  39.     }
  40. };
  41.