Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
646 B

  1. #ifndef _COWSITE_H_
  2. #define _COWSITE_H_
  3. #include <ocidl.h>
  4. #define ATOMICRELEASE(p) \
  5. { \
  6. IUnknown *pFoo = (IUnknown *)p; \
  7. p = NULL; \
  8. if (pFoo) \
  9. pFoo->Release(); \
  10. }
  11. class CObjectWithSite : public IObjectWithSite
  12. {
  13. public:
  14. CObjectWithSite() {_punkSite = NULL;};
  15. virtual ~CObjectWithSite() {ATOMICRELEASE(_punkSite);}
  16. //*** IUnknown ****
  17. // (client must provide!)
  18. //*** IObjectWithSite ***
  19. STDMETHOD(SetSite)(IUnknown *punkSite);
  20. STDMETHOD(GetSite)(REFIID riid, void **ppvSite);
  21. protected:
  22. IUnknown* _punkSite;
  23. };
  24. #endif