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.

69 lines
1.5 KiB

  1. // Factory.h -- Header file for this COM dll's class factory
  2. #ifndef __FACTORY_H__
  3. #define __FACTORY_H__
  4. class CFactory : public CITUnknown
  5. {
  6. public:
  7. // Main Object Constructor & Destructor.
  8. ~CFactory(void);
  9. static STDMETHODIMP Create(REFCLSID rclsid, REFIID riid, PVOID *ppv);
  10. private:
  11. CFactory(IUnknown* pUnkOuter);
  12. // We declare nested class interface implementations here.
  13. // We implement the IClassFactory interface (ofcourse) in this class
  14. // factory COM object class.
  15. class CImpIClassFactory : public IITClassFactory
  16. {
  17. public:
  18. // Interface Implementation Constructor & Destructor.
  19. CImpIClassFactory(CFactory* pBackObj, IUnknown* pUnkOuter);
  20. ~CImpIClassFactory(void);
  21. STDMETHODIMP Init(REFCLSID rclsid);
  22. // IClassFactory methods.
  23. STDMETHODIMP CreateInstance(IUnknown*, REFIID, PPVOID);
  24. STDMETHODIMP LockServer(BOOL);
  25. private:
  26. CLSID m_clsid;
  27. };
  28. CImpIClassFactory m_ImpIClassFactory;
  29. };
  30. typedef CFactory* PCFactory;
  31. inline CFactory::CFactory(IUnknown *pUnkOuter)
  32. : m_ImpIClassFactory(this, pUnkOuter),
  33. CITUnknown(&IID_IClassFactory, 1, &m_ImpIClassFactory)
  34. {
  35. }
  36. inline CFactory::~CFactory(void)
  37. {
  38. }
  39. inline CFactory::CImpIClassFactory::CImpIClassFactory
  40. (CFactory *pBackObj, IUnknown *punkOuter)
  41. : IITClassFactory(pBackObj, punkOuter)
  42. {
  43. m_clsid = CLSID_NULL;
  44. }
  45. inline CFactory::CImpIClassFactory::~CImpIClassFactory(void)
  46. {
  47. }
  48. #endif // __FACTORY_H__