home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / power.h < prev    next >
C/C++ Source or Header  |  1997-10-25  |  2KB  |  63 lines

  1. // Power.h : Declaration of the CPower
  2.  
  3.  
  4. #include "resource.h"       // main symbols
  5.  
  6. #include <asptlb.h>         // ASP Definitions
  7.  
  8. // 'asptlb.h' is installed with Active Server Pages.  Either copy it
  9. // to your Include directory or add the appropriate directory to your
  10. // Include Path.
  11.  
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CATLPwr
  14.  
  15. class CPower : 
  16.     public CComDualImpl<IPower, &IID_IPower, &LIBID_CATLPwr>, 
  17.     public ISupportErrorInfo,
  18.     public CComObjectRoot,
  19.     public CComCoClass<CPower,&CLSID_CPower>
  20. {
  21. public:
  22.     CPower();
  23. BEGIN_COM_MAP(CPower)
  24.     COM_INTERFACE_ENTRY(IDispatch)
  25.     COM_INTERFACE_ENTRY(IPower)
  26.     COM_INTERFACE_ENTRY(ISupportErrorInfo)
  27.     COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  28. END_COM_MAP()
  29. //DECLARE_NOT_AGGREGATABLE(CPower) 
  30. // Remove the comment from the line above if you don't want your object to 
  31. // support aggregation.  The default is to support it
  32.  
  33. DECLARE_REGISTRY(CPower, _T("IISSample.C++ATLPower.1"), _T("IISSample.C++ATLPower"), IDS_POWER_DESC, THREADFLAGS_BOTH)
  34. // ISupportsErrorInfo
  35.     STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  36.  
  37. // IPower
  38. public:
  39.     // for free-threaded marshalling
  40. DECLARE_GET_CONTROLLING_UNKNOWN()
  41.     HRESULT FinalCountruct()
  42.     {
  43.         return CoCreateFreeThreadedMarshaler(
  44.             GetControllingUnknown(), &m_pUnkMarshaler.p );
  45.     }
  46.     void FinalRelease()
  47.     {
  48.         m_pUnkMarshaler.Release();
  49.     }
  50.  
  51.     STDMETHOD(get_myProperty)(BSTR* pbstrOutValue);
  52.     STDMETHOD(put_myProperty)(BSTR bstrInValue);
  53.     STDMETHOD(myMethod)(BSTR bstrIn, BSTR* pbstrOut);
  54.  
  55.     // ASP-specific Property and Method
  56.     STDMETHOD(get_myPowerProperty)(BSTR* pbstrOutValue);
  57.     STDMETHOD(myPowerMethod)();
  58.  
  59. private:
  60.     CComPtr<IUnknown>            m_pUnkMarshaler;
  61.     CComBSTR                    m_bstrMyProperty;     // myProperty
  62. };
  63.