home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / BOCOLE.PAK / BOLEFACT.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  3KB  |  100 lines

  1. //
  2. //**************************************************************************
  3. //
  4. // BOleFact.h --   Declares the server-side helper for allowing OLE2 to
  5. //                 create objects made available by Bolero server apps.
  6. //
  7. // Copyright (c) 1993,94 by Borland International, Inc. All rights reserved
  8. //
  9. //**************************************************************************
  10.  
  11. #ifndef _BOLEFACT_H
  12. #define _BOLEFACT_H
  13.  
  14. #include "BOleComp.h"
  15.  
  16. class _ICLASS BOleSite;
  17. class _ICLASS BOleInProcFactory;
  18.  
  19. // class BOleFact -- OLE 2.0 Factory helper
  20. //
  21. class _ICLASS BOleFact : public BOleComponent, public IBClass
  22. {
  23. protected:
  24.     unsigned RefCnt;
  25.     BCID regId;
  26.     IBClassMgr * pObjCM;
  27.     DWORD hReg;
  28.     DWORD dwRegisterActiveObject;
  29.     CLSID id;
  30.     BOleInProcFactory FAR* pIPEFact;
  31.  
  32. public:
  33.  
  34.     BOleFact(BOleClassManager * pFact, IBUnknownMain *pOuter);
  35.     ~BOleFact();
  36.  
  37.     virtual HRESULT _IFUNC Init(BOOL fSelfEmbed, LPCOLESTR pszProgId, 
  38.                                    IBClassMgr * pCM, BCID rid);
  39.     virtual HRESULT _IFUNC Register(BOOL fSingleUse);
  40.     virtual HRESULT _IFUNC Revoke();
  41.     virtual HRESULT _IFUNC GetClassID(LPCLSID pClass);
  42.     virtual BOOL _IFUNC IsA(REFCLSID);
  43.     virtual BOOL _IFUNC AllowEmbedFromSelf ();
  44.     virtual HRESULT _IFUNC GetEmbeddingHelperFactory (LPUNKNOWN *ppF);
  45.     
  46.     IBClassMgr * ClassMgrGet() { return pObjCM; }
  47.     
  48.  
  49.     operator const CLSID &() const {return id;}
  50.     
  51.     // IUnknown Methods
  52.     //
  53.     DEFINE_IUNKNOWN(pObjOuter);
  54.  
  55.     virtual HRESULT _IFUNC QueryInterfaceMain(REFIID iid, LPVOID FAR* pif);
  56.  
  57.     // IClassFactory methods
  58.     //
  59.     HRESULT _IFUNC CreateInstance(IUnknown FAR* pUnk, REFIID iid, LPVOID FAR* ppv);
  60.     HRESULT _IFUNC LockServer(BOOL fLock);
  61. };
  62.  
  63.  
  64. // 
  65. // BOleInProcFactory -- Private factory used when a server object is
  66. //                      registered to be instantiated in its own container
  67. //
  68. class _ICLASS BOleInProcFactory : public BOleComponent, public IClassFactory
  69. {
  70.     public:
  71.  
  72.         BOleInProcFactory (BOleClassManager *,BOleFact FAR*, REFIID);
  73.         ~BOleInProcFactory ();
  74.  
  75.         HRESULT _IFUNC Register (BOOL);
  76.         HRESULT _IFUNC Revoke ();
  77.  
  78.         // IUnknown methods
  79.         //
  80.         virtual HRESULT _IFUNC QueryInterfaceMain (REFIID iid, LPVOID FAR* pif);
  81.         DEFINE_IUNKNOWN(pObjOuter);
  82.  
  83.     protected:
  84.  
  85.         ULONG nRef;
  86.         DWORD regCookie;
  87.         BOleFact *pRealFactory;
  88.         REFIID iidServer;
  89.  
  90.         // IClassFactory methods
  91.         //
  92.         virtual HRESULT _IFUNC CreateInstance (LPUNKNOWN pUnk, REFIID iid, 
  93.                                                       LPVOID FAR* ppv);
  94.         virtual HRESULT _IFUNC LockServer (BOOL fLock);
  95.  
  96. };
  97.  
  98. #endif
  99.  
  100.