home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / chap14 / beeper5 / beeper.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  2.4 KB  |  96 lines

  1. /*
  2.  * BEEPER.H
  3.  * Beeper Automation Object #5 Chapter 14
  4.  *
  5.  * Classes that implement the Beeper object.
  6.  *
  7.  * Copyright (c)1993-1995 Microsoft Corporation, All Right Reserved
  8.  *
  9.  * Kraig Brockschmidt, Microsoft
  10.  * Internet  :  kraigb@microsoft.com
  11.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  12.  */
  13.  
  14.  
  15. #ifndef _BEEPER_H_
  16. #define _BEEPER_H_
  17.  
  18. /*
  19.  * This #define tells <bookguid.h> to not define GUIDs that will
  20.  * be defined in MKTYPLIB-generated header files, like ibeeper.h.
  21.  */
  22. #define GUIDS_FROM_TYPELIB
  23. #define INC_AUTOMATION
  24. #define INC_CONTROLS
  25. #define CHAPTER14
  26. #include <inole.h>
  27.  
  28. //This file is generated from MKTYPLIB
  29. #include "ibeeper.h"
  30.  
  31. class CImpIProvideClassInfo;
  32. typedef class CImpIProvideClassInfo *PCImpIProvideClassInfo;
  33.  
  34.  
  35.  
  36. class CBeeper : public IBeeper
  37.     {
  38.     protected:
  39.         ULONG           m_cRef;         //Object reference count
  40.         LPUNKNOWN       m_pUnkOuter;    //Controlling unknown
  41.         PFNDESTROYED    m_pfnDestroy;   //To call on closure
  42.  
  43.         long            m_lSound;       //Type of sound
  44.  
  45.         ITypeInfo      *m_pITINeutral;  //Type information
  46.         IUnknown       *m_pIUnkStdDisp; //StdDispatch object
  47.  
  48.         PCImpIProvideClassInfo  m_pImpIProvideCI;
  49.  
  50.     public:
  51.         CBeeper(LPUNKNOWN, PFNDESTROYED);
  52.         ~CBeeper(void);
  53.  
  54.         BOOL         Init(void);
  55.  
  56.         //Non-delegating object IUnknown
  57.         STDMETHODIMP         QueryInterface(REFIID, PPVOID);
  58.         STDMETHODIMP_(ULONG) AddRef(void);
  59.         STDMETHODIMP_(ULONG) Release(void);
  60.  
  61.         //IBeeper functions
  62.         STDMETHODIMP_(long)  get_Sound(void);
  63.         STDMETHODIMP_(void)  put_Sound(long);
  64.         STDMETHODIMP_(long)  Beep(void);
  65.     };
  66.  
  67. typedef CBeeper *PCBeeper;
  68.  
  69.  
  70. class CImpIProvideClassInfo : public IProvideClassInfo
  71.     {
  72.     public:
  73.         ULONG           m_cRef;     //For debugging
  74.  
  75.     private:
  76.         LPUNKNOWN       m_pUnkOuter;
  77.         ITypeInfo      *m_pITI;     //To return from GetClassInfo
  78.  
  79.     public:
  80.         CImpIProvideClassInfo(LPUNKNOWN, ITypeLib *);
  81.         ~CImpIProvideClassInfo(void);
  82.  
  83.         //IUnknown members that delegate to m_pUnkOuter.
  84.         STDMETHODIMP         QueryInterface(REFIID, PPVOID);
  85.         STDMETHODIMP_(ULONG) AddRef(void);
  86.         STDMETHODIMP_(ULONG) Release(void);
  87.  
  88.         //IProvideClassInfo members
  89.         STDMETHODIMP GetClassInfo(ITypeInfo **);
  90.  
  91.     };
  92.  
  93.  
  94.  
  95. #endif //_BEEPER_H_
  96.