home *** CD-ROM | disk | FTP | other *** search
/ Supercompiler 1997 / SUPERCOMPILER97.iso / MS_VC.50 / SharedIDE / TEMPLATE / ATL / ASP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-16  |  3.5 KB  |  143 lines

  1. [!if=(FreeThreadedMarshaler, "TRUE")]
  2.     [!set(NeedsGetControllingUnknown, "TRUE")]
  3. [!endif]
  4. // [!HeaderName] : Declaration of the [!ClassName]
  5. [!crlf]
  6.  
  7. #ifndef __[!UpperShortName]_H_
  8. #define __[!UpperShortName]_H_
  9. [!crlf]
  10.  
  11. #include "resource.h"       // main symbols
  12. #include <asptlb.h>         // Active Server Pages Definitions
  13. [!crlf]
  14. /////////////////////////////////////////////////////////////////////////////
  15. // [!ClassName]
  16.  
  17. class ATL_NO_VTABLE [!ClassName] : 
  18. [!if=(ThreadingModel, "Single")]
  19.     public CComObjectRootEx<CComSingleThreadModel>,
  20. [!endif]
  21. [!if=(ThreadingModel, "Apartment")]
  22.     public CComObjectRootEx<CComSingleThreadModel>,
  23. [!endif]
  24. [!if=(ThreadingModel, "Both")]
  25.     public CComObjectRootEx<CComMultiThreadModel>,
  26. [!endif]
  27. [!if=(ThreadingModel, "Free")]
  28.     public CComObjectRootEx<CComMultiThreadModel>,
  29. [!endif]
  30.     public CComCoClass<[!ClassName], &CLSID_[!CoClassName]>,
  31. [!if=(ErrorInfoEnabled, "TRUE")]
  32.     public ISupportErrorInfo,
  33. [!endif]
  34. [!if=(ConnectionPointsEnabled, "TRUE")]
  35.     public IConnectionPointContainerImpl<[!ClassName]>,
  36. [!endif]
  37. [!if=(Dual, "TRUE")]
  38.     public IDispatchImpl<[!InterfaceName], &IID_[!InterfaceName], &LIBID_[!LibName]>
  39. [!else]
  40.     public [!InterfaceName]
  41. [!endif]
  42. {
  43. public:
  44.     [!ClassName]()
  45.     { 
  46. [!if=(FreeThreadedMarshaler, "TRUE")]        m_pUnkMarshaler = NULL;[!endif]
  47. [!if=(OnStartPage, "TRUE")]        m_bOnStartPageCalled = FALSE;[!endif]
  48.     }
  49. [!crlf]
  50. public:
  51. [!crlf]
  52. DECLARE_REGISTRY_RESOURCEID(IDR_[!UpperShortName])
  53.  
  54. [!if=(Aggregatable, "NO")]
  55. DECLARE_NOT_AGGREGATABLE([!ClassName])
  56. [!endif]
  57. [!if=(Aggregatable, "ONLY")]
  58. DECLARE_ONLY_AGGREGATABLE([!ClassName])
  59. [!endif]
  60.  
  61. [!if=(NeedsGetControllingUnknown, "TRUE")]
  62. DECLARE_GET_CONTROLLING_UNKNOWN()
  63. [!endif]
  64.  
  65. [!crlf]
  66. BEGIN_COM_MAP([!ClassName])
  67.     COM_INTERFACE_ENTRY([!InterfaceName])
  68. [!if=(Dual, "TRUE")]
  69.     COM_INTERFACE_ENTRY(IDispatch)
  70. [!endif]
  71. [!if=(ErrorInfoEnabled, "TRUE")]
  72.     COM_INTERFACE_ENTRY(ISupportErrorInfo)
  73. [!endif]
  74. [!if=(ConnectionPointsEnabled, "TRUE")]
  75.     COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  76. [!endif]
  77. [!if=(FreeThreadedMarshaler, "TRUE")]
  78.     COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  79. [!endif]
  80. END_COM_MAP()
  81.  
  82. [!if=(ConnectionPointsEnabled, "TRUE")]
  83. [!crlf]
  84. BEGIN_CONNECTION_POINT_MAP([!ClassName])
  85. END_CONNECTION_POINT_MAP()
  86. [!crlf]
  87. [!endif]
  88.  
  89. [!if=(FreeThreadedMarshaler, "TRUE")]
  90. [!crlf]
  91.     HRESULT FinalConstruct()
  92.     {
  93.         return CoCreateFreeThreadedMarshaler(
  94.             GetControllingUnknown(), &m_pUnkMarshaler.p);
  95.     }
  96.  
  97. [!crlf]
  98.     void FinalRelease()
  99.     {
  100.         m_pUnkMarshaler.Release();
  101.     }
  102.  
  103. [!crlf]
  104.     CComPtr<IUnknown> m_pUnkMarshaler;
  105. [!endif]
  106.  
  107. [!if=(ErrorInfoEnabled, "TRUE")]
  108. [!crlf]
  109. // ISupportsErrorInfo
  110.     STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  111. [!endif]
  112.  
  113. [!crlf]
  114. // [!InterfaceName]
  115. public:
  116. [!if=(OnStartPage, "TRUE")]
  117.     //Active Server Pages Methods
  118.     STDMETHOD(OnStartPage)(IUnknown* IUnk);
  119.     STDMETHOD(OnEndPage)();
  120. [!crlf]
  121. private:
  122. [!if=(Request, "TRUE")]
  123.     CComPtr<IRequest> m_piRequest;                    //Request Object
  124. [!endif]
  125. [!if=(Response, "TRUE")]
  126.     CComPtr<IResponse> m_piResponse;                //Response Object
  127. [!endif]
  128. [!if=(Session, "TRUE")]
  129.     CComPtr<ISessionObject> m_piSession;            //Session Object
  130. [!endif]
  131. [!if=(Server, "TRUE")]
  132.     CComPtr<IServer> m_piServer;                    //Server Object
  133. [!endif]
  134. [!if=(Application, "TRUE")]
  135.     CComPtr<IApplicationObject> m_piApplication;    //Application Object
  136. [!endif]
  137.     BOOL m_bOnStartPageCalled;                        //OnStartPage successful?
  138. [!endif]
  139. };
  140.  
  141. [!crlf]
  142. #endif //__[!UpperShortName]_H_
  143.