home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / CBuilder5 / INSTALL / DATA1.CAB / Program_Built_Files / ObjRepos / mtsobject.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-02-01  |  2.5 KB  |  95 lines

  1. [!outputon] // $Revision:   1.6.1.1  $
  2. // [!HeaderName] : Declaration of the [!ClassName]
  3.  
  4. #ifndef [!IDEHeaderName]
  5. #define [!IDEHeaderName]
  6.  
  7. #include "[!TypeLibModuleName].H"
  8.  
  9. #define _MTX_NOFORCE_LIBS
  10. #include <vcl\mtshlpr.h>
  11.  
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // [!ClassName]     Implements [!InterfaceName], default interface of [!CoClassName]
  15. [!if=(ConnectionPointsEnabled, "TRUE")]
  16. //                  and [!InterfaceName]Events, the default source interface
  17. [!endif]
  18. // ThreadingModel : [!ThreadingModel]
  19. // Dual Interface : [!Dual]
  20. // Event Support  : [!ConnectionPointsEnabled]
  21. // Default ProgID : [!ProgID]
  22. // Description    : [!Description]
  23. /////////////////////////////////////////////////////////////////////////////
  24. class ATL_NO_VTABLE [!ClassName] : 
  25.   public CComObjectRootEx<CComSingleThreadModel>,
  26.   public CComCoClass<[!ClassName], &CLSID_[!CoClassName]>,
  27. [!if=(ObjectControl, "TRUE")]
  28.   public IObjectControl,
  29. [!endif]
  30. [!if=(Dual, "TRUE")]
  31.   public IDispatchImpl<[!InterfaceName], &IID_[!InterfaceName], &LIBID_[!LibName]>
  32. [!else]
  33.   public [!InterfaceName]
  34. [!endif]
  35. {
  36. public:
  37.   [!ClassName]()
  38.   {
  39.   }
  40.  
  41.   // Data used when registering Object 
  42.   //
  43. [!if=(ThreadingModel, "tmSingle")]
  44.   DECLARE_THREADING_MODEL(otSingle);
  45. [!endif]
  46. [!if=(ThreadingModel, "tmApartment")]
  47.   DECLARE_THREADING_MODEL(otApartment);
  48. [!endif]
  49. [!if=(ThreadingModel, "tmFree")]    // MTS does not support Free Threading Model (Default to Both)
  50.   DECLARE_THREADING_MODEL(otBoth);
  51. [!endif]
  52. [!if=(ThreadingModel, "tmBoth")]
  53.   DECLARE_THREADING_MODEL(otBoth);
  54. [!endif]
  55.   DECLARE_PROGID("");
  56.   DECLARE_DESCRIPTION("[!Description]");
  57.  
  58.   // Function invoked to (un)register object
  59.   //
  60.   static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
  61.   {
  62.     TTypedComServerRegistrarT<[!ClassName]> 
  63.     regObj(GetObjectCLSID(), GetProgID(), GetDescription());
  64.     return regObj.UpdateRegistry(bRegister);
  65.   }
  66.  
  67. DECLARE_NOT_AGGREGATABLE([!ClassName])
  68.  
  69. BEGIN_COM_MAP([!ClassName])
  70.   COM_INTERFACE_ENTRY([!InterfaceName])
  71. [!if=(ObjectControl, "TRUE")]
  72.   COM_INTERFACE_ENTRY(IObjectControl)
  73. [!endif]
  74. [!if=(Dual, "TRUE")]
  75.   COM_INTERFACE_ENTRY(IDispatch)
  76. [!endif]
  77. END_COM_MAP()
  78.  
  79. [!if=(ObjectControl, "TRUE")]
  80. // IObjectControl
  81. public:
  82.   STDMETHOD(Activate)();
  83.   STDMETHOD_(BOOL, CanBePooled)();
  84.   STDMETHOD_(void, Deactivate)();
  85.  
  86.   CComPtr<IObjectContext> m_spObjectContext;
  87.  
  88. [!endif]
  89. // [!InterfaceName]
  90. public:
  91.  
  92. };
  93.  
  94. #endif //[!IDEHeaderName]
  95.