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.

97 lines
3.7 KiB

  1. #ifndef _ADBAR_H
  2. #define _ADBAR_H
  3. #include "mehost.h"
  4. //Util functions used only in Ads
  5. HRESULT HrEscapeOtherAdToken(LPSTR pszAdOther, LPSTR pszEncodedString, DWORD cch, DWORD *cchRetCount);
  6. HRESULT HrProcessAdTokens(LPSTR pszAdInfo, LPCSTR pszToken, LPSTR pszretval, DWORD cch, DWORD *pcchCount);
  7. //Strings for Ads
  8. const CHAR c_szAdPaneOn[] = "On";
  9. const CHAR c_szAdPaneOff[] = "Off";
  10. const CHAR c_szAdOther[] = "Other";
  11. const CHAR c_szRedirectAdUrl[] = "http://services.msn.com/svcs/oe/ads.asp?Version=";
  12. const CHAR c_szAdSvrFormat[] = "&AdSvr=";
  13. const CHAR c_szAdOtherFormat[] = "&Other=";
  14. const CHAR c_szAdRedirectFormat[] = "%s%s%s%s%s%s";
  15. const CHAR c_szAdPane[] = "AdPane";
  16. const CHAR c_szAdSvr[] = "AdSvr";
  17. const CHAR c_szEqualSign[] = "%3d";
  18. const CHAR c_szAmpersandSign[] = "%20";
  19. const CHAR c_szSpaceSign[] = "%26";
  20. //Constants used only for Ads
  21. #define CCH_ADPANE_OFF (sizeof(c_szAdPaneOff) / sizeof(*c_szAdPaneOff))
  22. #define CCH_ADPANE_ON (sizeof(c_szAdPaneOn) / sizeof(*c_szAdPaneOn))
  23. #define CCH_REDIRECT_ADURL (sizeof(c_szRedirectAdUrl) / sizeof(*c_szRedirectAdUrl))
  24. #define CCH_ADSVR_TOKEN_FORMAT (sizeof(c_szAdSvrFormat) / sizeof(*c_szAdSvrFormat))
  25. #define CCH_OTHER_FORMAT (sizeof(c_szAdOther) / sizeof(*c_szAdOther))
  26. #define CCH_AD_OTHER_FORMAT (sizeof(c_szAdOtherFormat) / sizeof(*c_szAdOtherFormat))
  27. class CAdBar :
  28. public IDockingWindow,
  29. public IObjectWithSite,
  30. public IInputObject
  31. {
  32. public:
  33. CAdBar();
  34. virtual ~CAdBar();
  35. // IUnknown
  36. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID FAR *);
  37. virtual ULONG STDMETHODCALLTYPE AddRef();
  38. virtual ULONG STDMETHODCALLTYPE Release();
  39. // IOleWindow methods
  40. virtual STDMETHODIMP GetWindow(HWND *phwnd);
  41. virtual STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
  42. // IDockingWindow
  43. virtual STDMETHODIMP ShowDW(BOOL fShow);
  44. virtual STDMETHODIMP CloseDW(DWORD dwReserved);
  45. virtual STDMETHODIMP ResizeBorderDW(LPCRECT prcBorder,
  46. IUnknown* punkToolbarSite,
  47. BOOL fReserved);
  48. // IObjectWithSite
  49. virtual STDMETHODIMP SetSite(IUnknown* punkSite);
  50. virtual STDMETHODIMP GetSite(REFIID riid, LPVOID * ppvSite);
  51. // IInputObject
  52. virtual STDMETHODIMP UIActivateIO(BOOL fActivate, LPMSG lpMsg);
  53. virtual STDMETHODIMP HasFocusIO();
  54. virtual STDMETHODIMP TranslateAcceleratorIO(LPMSG lpmsg);
  55. // overrides of CBody
  56. virtual HRESULT STDMETHODCALLTYPE OnUIActivate();
  57. virtual HRESULT STDMETHODCALLTYPE GetDropTarget(IDropTarget * pDropTarget, IDropTarget ** ppDropTarget);
  58. HRESULT HrInit(BSTR bstr);
  59. HRESULT SetUrl(LPSTR pszUrl);
  60. BOOL fValidUrl();
  61. int GetAdBar_Top() { return( (int) HIWORD(m_dwAdBarPos));}
  62. int GetAdBar_Bottom() { return( (int) LOWORD(m_dwAdBarPos));}
  63. protected:
  64. LRESULT AdBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  65. static LRESULT CALLBACK ExtAdBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  66. BOOL OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct);
  67. void OnSize(HWND hwnd, UINT state, int cxClient, int cyClient);
  68. private:
  69. IDockingWindowSite *m_ptbSite;
  70. HWND m_hwnd;
  71. HWND m_hwndParent;
  72. int m_cSize;
  73. DWORD m_dwAdBarPos;
  74. LPSTR m_pszUrl;
  75. BOOL m_fFirstPos;
  76. BOOL m_fDragging;
  77. ULONG m_cRef;
  78. CMimeEditDocHost *m_pMehost;
  79. };
  80. #endif // _ADBAR_H