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.

94 lines
2.5 KiB

  1. // BrowCap.h : Declaration of the CBrowserCap
  2. #ifndef __BROWSERCAP_H_
  3. #define __BROWSERCAP_H_
  4. #include "resource.h" // main symbols
  5. #include <asptlb.h> // Active Server Pages Definitions
  6. #include "Lock.h"
  7. /////////////////////////////////////////////////////////////////////////////
  8. // CBrowserFactory
  9. // --- Create BrowsCap objects from cache.
  10. class CBrowserFactory : public CComClassFactory
  11. {
  12. LONG m_cRefs;
  13. public:
  14. HRESULT STDMETHODCALLTYPE QueryInterface(const IID &, void **);
  15. ULONG STDMETHODCALLTYPE AddRef();
  16. ULONG STDMETHODCALLTYPE Release();
  17. HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown *, const IID &, void **);
  18. };
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CBrowserCap
  21. class ATL_NO_VTABLE CBrowserCap :
  22. public CComObjectRootEx<CComMultiThreadModel>,
  23. public CComCoClass<CBrowserCap, &CLSID_BrowserCap>,
  24. public ISupportErrorInfo,
  25. public IDispatchImpl<IBrowserCap, &IID_IBrowserCap, &LIBID_BrowserType>
  26. {
  27. public:
  28. CBrowserCap();
  29. ~CBrowserCap();
  30. public:
  31. DECLARE_REGISTRY_RESOURCEID(IDR_BROWSERCAP)
  32. DECLARE_GET_CONTROLLING_UNKNOWN()
  33. DECLARE_CLASSFACTORY_EX(CBrowserFactory)
  34. BEGIN_COM_MAP(CBrowserCap)
  35. COM_INTERFACE_ENTRY(IBrowserCap)
  36. COM_INTERFACE_ENTRY(IDispatch)
  37. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  38. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  39. END_COM_MAP()
  40. HRESULT FinalConstruct()
  41. {
  42. return CoCreateFreeThreadedMarshaler(
  43. GetControllingUnknown(), &m_pUnkMarshaler.p );
  44. }
  45. void FinalRelease()
  46. {
  47. m_pUnkMarshaler.Release();
  48. }
  49. // methods to build property DB
  50. void AddProperty(TCHAR *szName, TCHAR *szValue, BOOL fOverwriteProperty = FALSE);
  51. // Clone the object
  52. HRESULT Clone(CBrowserCap **ppBrowserCapCopy);
  53. // ISupportsErrorInfo
  54. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  55. // Load string resource
  56. void LoadString(UINT, TCHAR *szText);
  57. public:
  58. // IUnknown methods
  59. HRESULT STDMETHODCALLTYPE QueryInterface(const IID &, void **);
  60. ULONG STDMETHODCALLTYPE AddRef();
  61. ULONG STDMETHODCALLTYPE Release();
  62. // IDispatch Methods
  63. STDMETHOD(Invoke)(DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
  64. STDMETHOD(GetIDsOfNames)( REFIID, LPOLESTR*, UINT, LCID, DISPID* );
  65. //Active Server Pages Methods
  66. STDMETHOD(get_Value)(BSTR, /*[out, retval]*/ VARIANT *pVal);
  67. private:
  68. DISPID DispatchID( LPOLESTR );
  69. CComPtr< IUnknown > m_pUnkMarshaler;
  70. TSafeStringMap< CComVariant > m_strmapProperties;
  71. };
  72. #endif //__BROWSERCAP_H_