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.

220 lines
7.9 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  4. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  6. // PARTICULAR PURPOSE.
  7. //
  8. // Copyright 1998 Microsoft Corporation. All Rights Reserved.
  9. //
  10. // Author: Scott Roberts, Microsoft Developer Support - Internet Client SDK
  11. //
  12. // Portions of this code were taken from the bandobj sample that comes
  13. // with the Internet Client SDK for Internet Explorer 4.0x
  14. //
  15. //
  16. // BLHost.h - CBLHost declaration
  17. /////////////////////////////////////////////////////////////////////////////
  18. #ifndef __BLHost_h__
  19. #define __BLHost_h__
  20. #include <windows.h>
  21. #include <shlobj.h>
  22. // #include <stack>
  23. // #include <string>
  24. #include "baui.h"
  25. // using namespace std;
  26. #include "Globals.h"
  27. #define EB_CLASS_NAME (TEXT("BLHostClass"))
  28. #define MIN_SIZE_X 10
  29. #define MIN_SIZE_Y 10
  30. #define IDM_REFRESH 0
  31. #define IDM_OPENINWINDOW 1
  32. #define IDM_SEARCHMENU WM_USER + 200
  33. #define IDM_ONTHEINTERNET WM_USER + 202
  34. #define IDM_FIRSTURL WM_USER + 250
  35. #define IDM_LASTURL WM_USER + 260 // We allow 10 Urls in the menu.
  36. // In Internet Explorer 5.0, there
  37. // are only 5 stored in the registry.
  38. class CBLHost : public IDeskBand,
  39. public IInputObject,
  40. public IObjectWithSite,
  41. public IPersistStream,
  42. public IContextMenu,
  43. public IOleClientSite,
  44. public IOleInPlaceSite,
  45. public IOleControlSite,
  46. public IOleCommandTarget,
  47. public IDispatch
  48. {
  49. public:
  50. CBLHost();
  51. ~CBLHost();
  52. protected:
  53. // IUnknown methods
  54. STDMETHOD(QueryInterface)(REFIID iid, void** ppvObject);
  55. STDMETHOD_(ULONG, AddRef)();
  56. STDMETHOD_(DWORD, Release)();
  57. // IOleWindow methods
  58. STDMETHOD(GetWindow)(HWND* phwnd);
  59. STDMETHOD(ContextSensitiveHelp)(BOOL fEnterMode);
  60. // IDockingWindow methods
  61. STDMETHOD(ShowDW)(BOOL fShow);
  62. STDMETHOD(CloseDW)(DWORD dwReserved);
  63. STDMETHOD(ResizeBorderDW)(LPCRECT prcBorder, IUnknown* punkToolbarSite, BOOL fReserved);
  64. // IDeskBand methods
  65. STDMETHOD(GetBandInfo)(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO* pdbi);
  66. // IInputObject methods
  67. STDMETHOD(UIActivateIO)(BOOL fActivate, LPMSG lpMsg);
  68. STDMETHOD(HasFocusIO)(void);
  69. STDMETHOD(TranslateAcceleratorIO)(LPMSG lpMsg);
  70. // IObjectWithSite methods
  71. STDMETHOD(SetSite)(IUnknown* pUnkSite);
  72. STDMETHOD(GetSite)(REFIID riid, void** ppvSite);
  73. // IPersistStream methods
  74. STDMETHOD(GetClassID)(CLSID* pClassID);
  75. STDMETHOD(IsDirty)(void);
  76. STDMETHOD(Load)(LPSTREAM pStm);
  77. STDMETHOD(Save)(LPSTREAM pStm, BOOL fClearDirty);
  78. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pcbSize);
  79. // IContextMenu methods
  80. STDMETHOD(QueryContextMenu)(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags);
  81. STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpici);
  82. STDMETHOD(GetCommandString)(UINT_PTR idCmd, UINT uType, UINT* pwReserved, LPSTR pszName, UINT cchMax);
  83. // IOleClientSite methods
  84. STDMETHOD(SaveObject)();
  85. STDMETHOD(GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER* ppmk);
  86. STDMETHOD(GetContainer)(LPOLECONTAINER* ppContainer);
  87. STDMETHOD(ShowObject)();
  88. STDMETHOD(OnShowWindow)(BOOL fShow);
  89. STDMETHOD(RequestNewObjectLayout)();
  90. // IOleInPlaceSite Methods
  91. STDMETHOD(CanInPlaceActivate)();
  92. STDMETHOD(OnInPlaceActivate)();
  93. STDMETHOD(OnUIActivate)();
  94. STDMETHOD(GetWindowContext)(IOleInPlaceFrame** ppFrame, IOleInPlaceUIWindow** ppDoc,
  95. LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
  96. STDMETHOD(Scroll)(SIZE scrollExtent);
  97. STDMETHOD(OnUIDeactivate)(BOOL fUndoable);
  98. STDMETHOD(OnInPlaceDeactivate)();
  99. STDMETHOD(DiscardUndoState)();
  100. STDMETHOD(DeactivateAndUndo)();
  101. STDMETHOD(OnPosRectChange)(LPCRECT lprcPosRect);
  102. // IOleControlSite Methods
  103. STDMETHOD(OnControlInfoChanged)(void);
  104. STDMETHOD(LockInPlaceActive)(BOOL fLock);
  105. STDMETHOD(GetExtendedControl)(LPDISPATCH* ppDisp);
  106. STDMETHOD(TransformCoords)(POINTL* pPtlHimetric, POINTF* pPtfContainer, DWORD dwFlags);
  107. STDMETHOD(TranslateAccelerator)(LPMSG lpMsg, DWORD grfModifiers);
  108. STDMETHOD(OnFocus)(BOOL fGotFocus);
  109. STDMETHOD(ShowPropertyFrame)(void);
  110. //IOleCommandTarget
  111. HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup,
  112. ULONG cCmds,
  113. OLECMD *prgCmds,
  114. OLECMDTEXT *pCmdText);
  115. HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup,
  116. DWORD nCmdID,
  117. DWORD nCmdExecOpt,
  118. VARIANTARG *pvaIn,
  119. VARIANTARG *pvaOut);
  120. // IDispatch Methods
  121. STDMETHOD(GetTypeInfoCount)(UINT* pctinfo);
  122. STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo);
  123. STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid,DISPID* rgDispId);
  124. STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
  125. VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr);
  126. protected:
  127. LONG _cRef;
  128. private:
  129. HWND _hwndParent; // HWND of the Parent
  130. HWND m_hWnd; // My HWND
  131. HWND m_hwndContact;
  132. DWORD _dwViewMode;
  133. DWORD _dwBandID;
  134. DWORD _dwWBCookie;
  135. HBRUSH m_hbr3DFace;
  136. HBRUSH m_hbrStaticText;
  137. HBRUSH m_hbr3DHighFace;
  138. HFONT m_hFont;
  139. HFONT m_hBoldFont;
  140. HFONT m_hUnderlineFont;
  141. UINT m_cyTitleBar;
  142. UINT m_TextHeight;
  143. BOOL m_fHighlightIndicator;
  144. BOOL m_fHighlightPressed;
  145. BOOL m_fButtonPressed;
  146. BOOL m_fButtonHighLight;
  147. BOOL m_fViewMenuPressed;
  148. BOOL m_fShowLoginPart;
  149. BOOL m_fStateChange;
  150. RECT m_rcTitleButton;
  151. RECT m_rcTextButton;
  152. TCHAR m_szTitleMenu[RESSTRMAX];
  153. TCHAR m_szButtonText[RESSTRMAX];
  154. WCHAR m_wszClickText[RESSTRMAX];
  155. WCHAR m_wszAttemptText[RESSTRMAX];
  156. WCHAR m_wszWaitText[RESSTRMAX];
  157. HWND m_hWndLogin;
  158. HWND m_hWndClick;
  159. COLORREF m_clrLink;
  160. COLORREF m_clrBack;
  161. BOOL m_fStrsAdded;
  162. LONG_PTR m_lStrOffset;
  163. // Interface pointers
  164. IUnknown* m_pUnkSite;
  165. IInputObjectSite* _pSite;
  166. IIEMsgAb* m_pIMsgrAB;
  167. private:
  168. // Message Handlers
  169. LRESULT OnKillFocus(void);
  170. LRESULT OnSetFocus(void);
  171. LRESULT OnPaint(void);
  172. LRESULT OnSize(void);
  173. LRESULT OnDrawItem(WPARAM wParam, LPARAM lParam);
  174. LRESULT OnCommand(WPARAM wParam, LPARAM lParam);
  175. LRESULT OnMouseMove(int x, int y, UINT keyFlags);
  176. void OnTimer(UINT wParam);
  177. void OnLButtonDown(int x, int y, UINT keyFlags);
  178. void OnLButtonUp(int x, int y, UINT keyFlags);
  179. void AddButtons(BOOL fAdd);
  180. void UpdateButtonArray(TBBUTTON *ptbDst, const TBBUTTON *ptbSrc, int ctb, LONG_PTR lStrOffset);
  181. // Helper Methods
  182. void FocusChange(BOOL);
  183. BOOL RegisterAndCreateWindow(void);
  184. void Cleanup(void);
  185. HRESULT GetConnectionPoint(LPUNKNOWN pUnk, REFIID riid, LPCONNECTIONPOINT* pCP);
  186. public:
  187. LRESULT WndProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
  188. };
  189. #endif // __BLHost_h__