Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.2 KiB

  1. // RotObj.h : Declaration of the CAdRotator
  2. #ifndef __ADROTATOR_H_
  3. #define __ADROTATOR_H_
  4. #include "resource.h" // main symbols
  5. #include <asptlb.h> // Active Server Pages Definitions
  6. #include "AdDesc.h"
  7. #include "AdFile.h"
  8. #include "lock.h"
  9. #include "eh.h"
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CAdRotator
  12. class ATL_NO_VTABLE CAdRotator :
  13. public CComObjectRoot,
  14. public CComCoClass<CAdRotator, &CLSID_AdRotator>,
  15. public ISupportErrorInfo,
  16. public IDispatchImpl<IAdRotator, &IID_IAdRotator, &LIBID_AdRotator>
  17. {
  18. public:
  19. CAdRotator();
  20. ~CAdRotator() { if (m_strTargetFrame) ::SysFreeString(m_strTargetFrame); }
  21. public:
  22. DECLARE_REGISTRY_RESOURCEID(IDR_ADROTATOR)
  23. DECLARE_GET_CONTROLLING_UNKNOWN()
  24. BEGIN_COM_MAP(CAdRotator)
  25. COM_INTERFACE_ENTRY(IAdRotator)
  26. COM_INTERFACE_ENTRY(IDispatch)
  27. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  28. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  29. END_COM_MAP()
  30. HRESULT FinalConstruct()
  31. {
  32. return CoCreateFreeThreadedMarshaler(
  33. GetControllingUnknown(), &m_pUnkMarshaler.p );
  34. }
  35. void FinalRelease()
  36. {
  37. m_pUnkMarshaler.Release();
  38. }
  39. // ISupportsErrorInfo
  40. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  41. // IAdRotator
  42. public:
  43. STDMETHOD(get_GetAdvertisement)(BSTR, /*[out, retval]*/ BSTR *pVal);
  44. STDMETHOD(get_TargetFrame)(/*[out, retval]*/ BSTR *pVal);
  45. STDMETHOD(put_TargetFrame)(/*[in]*/ BSTR newVal);
  46. STDMETHOD(get_Border)(/*[out, retval]*/ short *pVal);
  47. STDMETHOD(put_Border)(/*[in]*/ short newVal);
  48. STDMETHOD(get_Clickable)(/*[out, retval]*/ BOOL *pVal);
  49. STDMETHOD(put_Clickable)(/*[in]*/ BOOL newVal);
  50. static void ClearAdFiles();
  51. static void RaiseException( LPOLESTR );
  52. static void RaiseException( UINT );
  53. private:
  54. typedef TSafeStringMap< CAdFilePtr > AdFileMapT;
  55. CAdFilePtr AdFile( const String& strFile );
  56. CComAutoCriticalSection m_cs;
  57. bool m_bClickable;
  58. short m_nBorder;
  59. bool m_bBorderSet;
  60. BSTR m_strTargetFrame;
  61. String m_strAdFile;
  62. CComPtr<IUnknown> m_pUnkMarshaler;
  63. static AdFileMapT s_adFiles;
  64. };
  65. #endif //__ADROTATOR_H_