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

  1. // beepobj.h : main header file for BEEPER.DLL
  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. #include "beepres.h"       // main symbols
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // Beeper
  17.  
  18. class CBeeper;
  19.  
  20. class CBeeper2 :
  21.     public ISupportErrorInfo,
  22.     public CComTearOffObjectBase<CBeeper>
  23. {
  24. public:
  25.     CBeeper2() {}
  26.     STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid)
  27.     {
  28.         return (InlineIsEqualGUID(IID_IBeeper,riid)) ? S_OK : S_FALSE;
  29.     }
  30.  
  31. BEGIN_COM_MAP(CBeeper2)
  32.     COM_INTERFACE_ENTRY(ISupportErrorInfo)
  33. END_COM_MAP()
  34. };
  35.  
  36. class CBeeper :
  37.     public IDispatchImpl<IBeeper, &IID_IBeeper, &LIBID_BeeperLib>,
  38.     public CComObjectRoot,
  39.     public CComCoClass<CBeeper, &CLSID_Beeper>
  40. {
  41. public:
  42.     CBeeper();
  43.     BEGIN_COM_MAP(CBeeper)
  44.         COM_INTERFACE_ENTRY(IDispatch)
  45.         COM_INTERFACE_ENTRY(IBeeper)
  46.         COM_INTERFACE_ENTRY_TEAR_OFF(IID_ISupportErrorInfo, CBeeper2)
  47.     END_COM_MAP()
  48.  
  49.     DECLARE_NOT_AGGREGATABLE(CBeeper)
  50.     DECLARE_GET_CONTROLLING_UNKNOWN()
  51.     DECLARE_REGISTRY(CBeeper, _T("Acme.Beeper.1"), _T("Acme.Beeper"), IDS_BEEPER_DESC, THREADFLAGS_BOTH)
  52. // IBeeper
  53. public:
  54.     STDMETHOD(Beep)();
  55.     STDMETHOD(get_Count)(long* retval);
  56.     STDMETHOD(get_Item)(long Index, BSTR* pbstr);
  57.     STDMETHOD(get__NewEnum)(IUnknown** retval);
  58. private:
  59.     int m_nCnt;
  60.     CComVariant m_var[4];
  61. };
  62.