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 / chap02 / enumrect / ienum.h < prev    next >
C/C++ Source or Header  |  1995-05-03  |  2KB  |  69 lines

  1. /*
  2.  * IENUM0.H
  3.  *
  4.  * Definition of an IEnumRECT interface as an example of OLE
  5.  * interfaces as they appear in C and C++.
  6.  *
  7.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  8.  *
  9.  * Kraig Brockschmidt, Microsoft
  10.  * Internet  :  kraigb@microsoft.com
  11.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  12.  */
  13.  
  14.  
  15. #ifndef _IENUM0_H_
  16. #define _IENUM0_H_
  17.  
  18.  
  19. //C++ Definition of an interface.
  20. #ifdef __cplusplus
  21.  
  22. typedef struct IEnumRECT IEnumRECT;
  23. typedef IEnumRECT *PENUMRECT;
  24.  
  25.  
  26. //This is the interface:  a struct of pure virtual functions.
  27. struct IEnumRECT
  28.     {
  29.     STDMETHOD(QueryInterface)(REFIID, PPVOID)=0;
  30.     STDMETHOD_(ULONG,AddRef)(void)=0;
  31.     STDMETHOD_(ULONG,Release)(void)=0;
  32.     STDMETHOD(Next)(DWORD, LPRECT, LPDWORD)=0;
  33.     STDMETHOD(Skip)(DWORD)=0;
  34.     STDMETHOD(Reset)(void)=0;
  35.     STDMETHOD(Clone)(PENUMRECT *)=0;
  36.     };
  37.  
  38. #else   //!__cplusplus
  39.  
  40. /*
  41.  * A C interface is explicitly a structure containing a long
  42.  * pointer to a virtual function table that we have to
  43.  * initialize explicitly.
  44.  */
  45.  
  46. typedef struct
  47.     {
  48.     struct IEnumRECTVtbl FAR *lpVtbl;
  49.     } IEnumRECT, *PENUMRECT;
  50.  
  51. //This is just a convenient naming
  52. typedef struct IEnumRECTVtbl IEnumRECTVtbl;
  53.  
  54.  
  55. struct IEnumRECTVtbl
  56.     {
  57.     STDMETHOD(QueryInterface)(PENUMRECT, REFIID, PPVOID);
  58.     STDMETHOD_(ULONG, AddRef)(PENUMRECT);
  59.     STDMETHOD_(ULONG, Release)(PENUMRECT);
  60.     STDMETHOD(Next)(PENUMRECT, DWORD, LPRECT, LPDWORD);
  61.     STDMETHOD(Skip)(PENUMRECT, DWORD);
  62.     STDMETHOD(Reset)(PENUMRECT);
  63.     STDMETHOD(Clone)(PENUMRECT, PENUMRECT *);
  64.     };
  65.  
  66. #endif  //!__cplusplus
  67.  
  68. #endif //_IENUM0_H_
  69.