home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / ole / tstcon / propbag.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  944 b   |  42 lines

  1. class CPropertyBagItem :
  2.    public CObject
  3. {
  4.    DECLARE_DYNAMIC( CPropertyBagItem );
  5.  
  6. public:
  7.    CPropertyBagItem( LPCOLESTR pszName, VARIANT* pvarValue );
  8.  
  9. public:
  10.    CString m_strName;
  11.    COleVariant m_varValue;
  12. };
  13.  
  14. typedef CTypedPtrList< CObList, CPropertyBagItem* > CPropertyBagItemList;
  15.  
  16. class CPropertyBag :
  17.    public IPropertyBag
  18. {
  19. public:
  20.    CPropertyBag();
  21.    ~CPropertyBag();
  22.  
  23.    POSITION GetFirstItemPosition() const;
  24.    CPropertyBagItem* GetNextItem( POSITION& posItem ) const;
  25.  
  26. // IUnknown
  27. public:
  28.    STDMETHOD_( ULONG, AddRef )();
  29.    STDMETHOD_( ULONG, Release )();
  30.    STDMETHOD( QueryInterface )( REFIID iid, void** ppInterface );
  31.  
  32. // IPropertyBag
  33. public:
  34.    STDMETHOD( Read )( LPCOLESTR pszPropName, VARIANT* pvarValue,
  35.       IErrorLog* pErrorLog );
  36.    STDMETHOD( Write )( LPCOLESTR pszPropName, VARIANT* pvarValue );
  37.  
  38. protected:
  39.    ULONG m_nRefCount;
  40.    CPropertyBagItemList m_lpItems;
  41. };
  42.