Source code of Windows XP (NT5)
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.

232 lines
8.8 KiB

  1. // Copyright (C) 1996-1997 Microsoft Corporation. All rights reserved.
  2. #if _MSC_VER > 1000
  3. #pragma once
  4. #endif
  5. #ifndef __WEB_H__
  6. #define __WEB_H__
  7. // Stolen from MFC
  8. // parameter types: by value VTs
  9. #define VTS_I2 "\x02" // a 'short'
  10. #define VTS_I4 "\x03" // a 'long'
  11. #define VTS_R4 "\x04" // a 'float'
  12. #define VTS_R8 "\x05" // a 'double'
  13. #define VTS_CY "\x06" // a 'CY' or 'CY*'
  14. #define VTS_DATE "\x07" // a 'DATE'
  15. #define VTS_WBSTR "\x08" // an 'LPCOLESTR'
  16. #define VTS_DISPATCH "\x09" // an 'IDispatch*'
  17. #define VTS_SCODE "\x0A" // an 'SCODE'
  18. #define VTS_BOOL "\x0B" // a 'BOOL'
  19. #define VTS_VARIANT "\x0C" // a 'const VARIANT&' or 'VARIANT*'
  20. #define VTS_UNKNOWN "\x0D" // an 'IUnknown*'
  21. #if defined(_UNICODE) || defined(OLE2ANSI)
  22. #define VTS_BSTR VTS_WBSTR// an 'LPCOLESTR'
  23. #define VT_BSTRT VT_BSTR
  24. #else
  25. #define VTS_BSTR "\x0E" // an 'LPCSTR'
  26. #define VT_BSTRA 14
  27. #define VT_BSTRT VT_BSTRA
  28. #endif
  29. #define VTS_UI1 "\x0F" // a 'BYTE'
  30. // parameter types: by reference VTs
  31. #define VTS_PI2 "\x42" // a 'short*'
  32. #define VTS_PI4 "\x43" // a 'long*'
  33. #define VTS_PR4 "\x44" // a 'float*'
  34. #define VTS_PR8 "\x45" // a 'double*'
  35. #define VTS_PCY "\x46" // a 'CY*'
  36. #define VTS_PDATE "\x47" // a 'DATE*'
  37. #define VTS_PBSTR "\x48" // a 'BSTR*'
  38. #define VTS_PDISPATCH "\x49" // an 'IDispatch**'
  39. #define VTS_PSCODE "\x4A" // an 'SCODE*'
  40. #define VTS_PBOOL "\x4B" // a 'VARIANT_BOOL*'
  41. #define VTS_PVARIANT "\x4C" // a 'VARIANT*'
  42. #define VTS_PUNKNOWN "\x4D" // an 'IUnknown**'
  43. #define VTS_PUI1 "\x4F" // a 'BYTE*'
  44. // special VT_ and VTS_ values
  45. #define VTS_NONE NULL // used for members with 0 params
  46. #define VT_MFCVALUE 0xFFF // special value for DISPID_VALUE
  47. #define VT_MFCBYREF 0x40 // indicates VT_BYREF type
  48. #define VT_MFCMARKER 0xFF // delimits named parameters (INTERNAL USE)
  49. // variant handling (use V_BSTRT when you have ANSI BSTRs, as in DAO)
  50. #ifndef _UNICODE
  51. #define V_BSTRT(b) (LPSTR)V_BSTR(b)
  52. #else
  53. #define V_BSTRT(b) V_BSTR(b)
  54. #endif
  55. /////////////////////////////////////////////////////////////////////////////
  56. // OLE control parameter types
  57. #define VTS_COLOR VTS_I4 // OLE_COLOR
  58. #define VTS_XPOS_PIXELS VTS_I4 // OLE_XPOS_PIXELS
  59. #define VTS_YPOS_PIXELS VTS_I4 // OLE_YPOS_PIXELS
  60. #define VTS_XSIZE_PIXELS VTS_I4 // OLE_XSIZE_PIXELS
  61. #define VTS_YSIZE_PIXELS VTS_I4 // OLE_YSIZE_PIXELS
  62. #define VTS_XPOS_HIMETRIC VTS_I4 // OLE_XPOS_HIMETRIC
  63. #define VTS_YPOS_HIMETRIC VTS_I4 // OLE_YPOS_HIMETRIC
  64. #define VTS_XSIZE_HIMETRIC VTS_I4 // OLE_XSIZE_HIMETRIC
  65. #define VTS_YSIZE_HIMETRIC VTS_I4 // OLE_YSIZE_HIMETRIC
  66. #define VTS_TRISTATE VTS_I2 // OLE_TRISTATE
  67. #define VTS_OPTEXCLUSIVE VTS_BOOL // OLE_OPTEXCLUSIVE
  68. #define VTS_PCOLOR VTS_PI4 // OLE_COLOR*
  69. #define VTS_PXPOS_PIXELS VTS_PI4 // OLE_XPOS_PIXELS*
  70. #define VTS_PYPOS_PIXELS VTS_PI4 // OLE_YPOS_PIXELS*
  71. #define VTS_PXSIZE_PIXELS VTS_PI4 // OLE_XSIZE_PIXELS*
  72. #define VTS_PYSIZE_PIXELS VTS_PI4 // OLE_YSIZE_PIXELS*
  73. #define VTS_PXPOS_HIMETRIC VTS_PI4 // OLE_XPOS_HIMETRIC*
  74. #define VTS_PYPOS_HIMETRIC VTS_PI4 // OLE_YPOS_HIMETRIC*
  75. #define VTS_PXSIZE_HIMETRIC VTS_PI4 // OLE_XSIZE_HIMETRIC*
  76. #define VTS_PYSIZE_HIMETRIC VTS_PI4 // OLE_YSIZE_HIMETRIC*
  77. #define VTS_PTRISTATE VTS_PI2 // OLE_TRISTATE*
  78. #define VTS_POPTEXCLUSIVE VTS_PBOOL // OLE_OPTEXCLUSIVE*
  79. #define VTS_FONT VTS_DISPATCH // IFontDispatch*
  80. #define VTS_PICTURE VTS_DISPATCH // IPictureDispatch*
  81. #define VTS_HANDLE VTS_I4 // OLE_HANDLE
  82. #define VTS_PHANDLE VTS_PI4 // OLE_HANDLE*
  83. class COleDispatchDriver
  84. {
  85. // Constructors
  86. public:
  87. COleDispatchDriver();
  88. COleDispatchDriver(LPDISPATCH lpDispatch, BOOL bAutoRelease = TRUE);
  89. COleDispatchDriver(const COleDispatchDriver& dispatchSrc);
  90. // Attributes
  91. LPDISPATCH m_lpDispatch;
  92. BOOL m_bAutoRelease;
  93. // Operations
  94. BOOL CreateDispatch(REFCLSID clsid);
  95. BOOL CreateDispatch(LPCTSTR lpszProgID);
  96. void AttachDispatch(LPDISPATCH lpDispatch, BOOL bAutoRelease = TRUE);
  97. LPDISPATCH DetachDispatch();
  98. // detach and get ownership of m_lpDispatch
  99. void ReleaseDispatch();
  100. // helpers for IDispatch::Invoke
  101. void __cdecl InvokeHelper(DISPID dwDispID, WORD wFlags,
  102. VARTYPE vtRet, void* pvRet, const BYTE* pbParamInfo, ...);
  103. void __cdecl SetProperty(DISPID dwDispID, VARTYPE vtProp, ...);
  104. void GetProperty(DISPID dwDispID, VARTYPE vtProp, void* pvProp) const;
  105. // special operators
  106. operator LPDISPATCH() { return m_lpDispatch; }
  107. const COleDispatchDriver& operator=(const COleDispatchDriver& dispatchSrc);
  108. // Implementation
  109. public:
  110. ~COleDispatchDriver() { ReleaseDispatch(); }
  111. void InvokeHelperV(DISPID dwDispID, WORD wFlags, VARTYPE vtRet,
  112. void* pvRet, const BYTE* pbParamInfo, va_list argList);
  113. };
  114. class DWebBrowserEventsImpl : public COleDispatchDriver
  115. {
  116. public:
  117. DWebBrowserEventsImpl() {} // Calls COleDispatchDriver default constructor
  118. DWebBrowserEventsImpl(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
  119. DWebBrowserEventsImpl(const DWebBrowserEventsImpl& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
  120. public:
  121. void BeforeNavigate(LPCTSTR URL, long Flags, LPCTSTR TargetFrameName, VARIANT* PostData, LPCTSTR Headers, BOOL* Cancel);
  122. void NavigateComplete(LPCTSTR URL);
  123. void StatusTextChange(LPCTSTR Text);
  124. void ProgressChange(long Progress, long ProgressMax);
  125. void DownloadComplete();
  126. void CommandStateChange(long Command, BOOL Enable);
  127. void DownloadBegin();
  128. void NewWindow(LPCTSTR URL, long Flags, LPCTSTR TargetFrameName, VARIANT* PostData, LPCTSTR Headers, BOOL* Processed);
  129. void TitleChange(LPCTSTR Text);
  130. void FrameBeforeNavigate(LPCTSTR URL, long Flags, LPCTSTR TargetFrameName, VARIANT* PostData, LPCTSTR Headers, BOOL* Cancel);
  131. void FrameNavigateComplete(LPCTSTR URL);
  132. void FrameNewWindow(LPCTSTR URL, long Flags, LPCTSTR TargetFrameName, VARIANT* PostData, LPCTSTR Headers, BOOL* Processed);
  133. void Quit(BOOL* Cancel);
  134. void WindowMove();
  135. void WindowResize();
  136. void WindowActivate();
  137. void PropertyChange(LPCTSTR szProperty);
  138. };
  139. class IWebBrowserAppImpl : public COleDispatchDriver
  140. {
  141. public:
  142. IWebBrowserAppImpl() {} // Calls COleDispatchDriver default constructor
  143. ~IWebBrowserAppImpl() {} // Calls COleDispatchDriver default destructor
  144. IWebBrowserAppImpl(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
  145. IWebBrowserAppImpl(const IWebBrowserAppImpl& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
  146. public:
  147. void GoBack();
  148. void GoForward();
  149. void GoHome();
  150. void GoSearch();
  151. void Navigate(LPCTSTR URL, VARIANT* Flags, VARIANT* TargetFrameName, VARIANT* PostData, VARIANT* Headers);
  152. void Refresh();
  153. void Refresh2(VARIANT* Level);
  154. void Stop();
  155. LPDISPATCH GetApplication();
  156. LPDISPATCH GetParent();
  157. LPDISPATCH GetContainer();
  158. LPDISPATCH GetDocument();
  159. BOOL GetTopLevelContainer();
  160. CStr* GetType();
  161. long GetLeft();
  162. void SetLeft(long nNewValue);
  163. long GetTop();
  164. void SetTop(long nNewValue);
  165. long GetWidth();
  166. void SetWidth(long nNewValue);
  167. long GetHeight();
  168. void SetHeight(long nNewValue);
  169. void GetLocationName(CStr* pcsz);
  170. void GetLocationURL(CStr* pcsz);
  171. BOOL GetBusy();
  172. void Quit();
  173. void ClientToWindow(long* pcx, long* pcy);
  174. void PutProperty(LPCTSTR szProperty, const VARIANT& vtValue);
  175. VARIANT GetProperty_(LPCTSTR szProperty);
  176. CStr* GetName();
  177. HWND GetHwnd();
  178. CStr* GetFullName();
  179. CStr* GetPath();
  180. BOOL GetVisible();
  181. void SetVisible(BOOL bNewValue);
  182. BOOL GetStatusBar();
  183. void SetStatusBar(BOOL bNewValue);
  184. CStr* GetStatusText();
  185. void SetStatusText(LPCTSTR lpszNewValue);
  186. long GetToolBar();
  187. void SetToolBar(long nNewValue);
  188. BOOL GetMenuBar();
  189. void SetMenuBar(BOOL bNewValue);
  190. BOOL GetFullScreen();
  191. void SetFullScreen(BOOL bNewValue);
  192. };
  193. #if 0
  194. void Navigate2(VARIANT* URL, VARIANT* Flags, VARIANT* TargetFrameName, VARIANT* PostData, VARIANT* Headers);
  195. long QueryStatusWB(long cmdID);
  196. void ExecWB(long cmdID, long cmdexecopt, VARIANT* pvaIn, VARIANT* pvaOut);
  197. long GetReadyState();
  198. BOOL GetOffline();
  199. void SetOffline(BOOL bNewValue);
  200. BOOL GetSilent();
  201. void SetSilent(BOOL bNewValue);
  202. BOOL GetRegisterAsBrowser();
  203. void SetRegisterAsBrowser(BOOL bNewValue);
  204. BOOL GetRegisterAsDropTarget();
  205. void SetRegisterAsDropTarget(BOOL bNewValue);
  206. #endif
  207. #endif // __WEB_H__