home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / common / msdev98 / template / atl / msdtx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-16  |  1.5 KB  |  72 lines

  1. // [!HeaderName] : Declaration of the [!ClassName]
  2. [!crlf]
  3.  
  4. [!if=(FileExists, "FALSE")]
  5. #ifndef __[!UpperShortName]_H_
  6. #define __[!UpperShortName]_H_
  7. [!crlf]
  8. #include "resource.h"       // main symbols
  9. #include <mtx.h>
  10. [!else]
  11. [!AddIncludeFile(TargetFile, "resource.h")]
  12. [!AddIncludeFile(TargetFile, "<mtx.h>")]
  13. [!endif]
  14. [!crlf]
  15. /////////////////////////////////////////////////////////////////////////////
  16. // [!ClassName]
  17.  
  18. class ATL_NO_VTABLE [!ClassName] : 
  19.     public CComObjectRootEx<CComSingleThreadModel>,
  20.     public CComCoClass<[!ClassName], &CLSID_[!CoClassName]>,
  21. [!if=(ObjectControl, "TRUE")]
  22.     public IObjectControl,
  23. [!endif]
  24. [!if=(Dual, "TRUE")]
  25.     public IDispatchImpl<[!InterfaceName], &IID_[!InterfaceName], &LIBID_[!LibName]>
  26. [!else]
  27.     public [!InterfaceName]
  28. [!endif]
  29. {
  30. public:
  31.     [!ClassName]()
  32.     {
  33.     }
  34.  
  35. [!crlf]
  36. DECLARE_REGISTRY_RESOURCEID([!IDR_REGISTRYID])
  37. [!crlf]
  38. DECLARE_PROTECT_FINAL_CONSTRUCT()
  39. [!crlf]
  40. DECLARE_NOT_AGGREGATABLE([!ClassName])
  41.  
  42. [!crlf]
  43. BEGIN_COM_MAP([!ClassName])
  44.     COM_INTERFACE_ENTRY([!InterfaceName])
  45. [!if=(ObjectControl, "TRUE")]
  46.     COM_INTERFACE_ENTRY(IObjectControl)
  47. [!endif]
  48. [!if=(Dual, "TRUE")]
  49.     COM_INTERFACE_ENTRY(IDispatch)
  50. [!endif]
  51. END_COM_MAP()
  52.  
  53. [!if=(ObjectControl, "TRUE")]
  54. [!crlf]
  55. // IObjectControl
  56. public:
  57.     STDMETHOD(Activate)();
  58.     STDMETHOD_(BOOL, CanBePooled)();
  59.     STDMETHOD_(void, Deactivate)();
  60. [!crlf]
  61.     CComPtr<IObjectContext> m_spObjectContext;
  62. [!endif]
  63. [!crlf]
  64. // [!InterfaceName]
  65. public:
  66. };
  67.  
  68. [!crlf]
  69. [!if=(FileExists, "FALSE")]
  70. #endif //__[!UpperShortName]_H_
  71. [!endif]
  72.