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

  1. // CPCDINFO.H : CDInfo manager class proxy declarations
  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. // CProxyCDEvents
  15. template <class T>
  16. // CPCDINFO.H : proxy class declaration
  17. //
  18. // This is a part of the Active Template Library.
  19. // Copyright (C) 1996-1998 Microsoft Corporation
  20. // All rights reserved.
  21. //
  22. // This source code is only intended as a supplement to the
  23. // Active Template Library Reference and related
  24. // electronic documentation provided with the library.
  25. // See these sources for detailed information regarding the
  26. // Active Template Library product.
  27.  
  28. class CProxyCDEvents :
  29.     public IConnectionPointImpl<T, &DIID_CDEvents, CComDynamicUnkArray>
  30. {
  31. public:
  32. //methods:
  33. //CDEvents : IDispatch
  34. public:
  35.     void Click(
  36.         short nTrack)
  37.     {
  38.         VARIANTARG* pvars = new VARIANTARG[1];
  39.         for (int i = 0; i < 1; i++)
  40.             VariantInit(&pvars[i]);
  41.         T* pT = (T*)this;
  42.         pT->Lock();
  43.         IUnknown** pp = m_vec.begin();
  44.         while (pp < m_vec.end())
  45.         {
  46.             if (*pp != NULL)
  47.             {
  48.                 pvars[0].vt = VT_I2;
  49.                 pvars[0].iVal= nTrack;
  50.                 DISPPARAMS disp = { pvars, NULL, 1, 0 };
  51.                 IDispatch* pDispatch = reinterpret_cast<IDispatch*>(*pp);
  52.                 pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT,
  53.                     DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  54.             }
  55.             pp++;
  56.         }
  57.         pT->Unlock();
  58.         delete[] pvars;
  59.     }
  60.  
  61. };
  62.