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

  1. // CPatlButn.h : connection point for button
  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. // CProxy_ATLButton
  15. template <class T>
  16. class CProxy_ATLButton :
  17.     public IConnectionPointImpl<T, &DIID__ATLButton, CComUnkArray<1> >
  18. {
  19. public:
  20. //methods:
  21. //_ATLButton : IDispatch
  22. public:
  23.     void OnClick()
  24.     {
  25.         T* pT = (T*)this;
  26.         pT->Lock();
  27.         IUnknown** pp = m_vec.begin();
  28.         while (pp < m_vec.end())
  29.         {
  30.             if (*pp != NULL)
  31.             {
  32.                 DISPPARAMS disp = { NULL, NULL, 0, 0 };
  33.                 IDispatch* pDispatch = reinterpret_cast<IDispatch*>(*pp);
  34.                 pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT,
  35.                     DISPATCH_METHOD, &disp, NULL, NULL, NULL);
  36.             }
  37.             pp++;
  38.         }
  39.         pT->Unlock();
  40.     }
  41. };
  42.