wined3d: Handle 3D textures in wined3d_device_copy_sub_resource_region().
[wine.git] / dlls / ieframe / webbrowser.c
blob03acf3886989606f88067aea8899855ad2fb5c9c
1 /*
2 * Implementation of IWebBrowser interface for WebBrowser control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2005 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "ieframe.h"
24 #include "exdispid.h"
25 #include "mshtml.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
31 static inline WebBrowser *impl_from_IWebBrowser2(IWebBrowser2 *iface)
33 return CONTAINING_RECORD(iface, WebBrowser, IWebBrowser2_iface);
36 static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
38 WebBrowser *This = impl_from_IWebBrowser2(iface);
40 if (ppv == NULL)
41 return E_POINTER;
42 *ppv = NULL;
44 if(IsEqualGUID(&IID_IUnknown, riid)) {
45 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
46 *ppv = &This->IWebBrowser2_iface;
47 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
48 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
49 *ppv = &This->IWebBrowser2_iface;
50 }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
51 TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
52 *ppv = &This->IWebBrowser2_iface;
53 }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
54 TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
55 *ppv = &This->IWebBrowser2_iface;
56 }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
57 TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
58 *ppv = &This->IWebBrowser2_iface;
59 }else if(IsEqualGUID(&IID_IOleObject, riid)) {
60 TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
61 *ppv = &This->IOleObject_iface;
62 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
63 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
64 *ppv = &This->IOleInPlaceObject_iface;
65 }else if(IsEqualGUID (&IID_IOleInPlaceObject, riid)) {
66 TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
67 *ppv = &This->IOleInPlaceObject_iface;
68 }else if(IsEqualGUID(&IID_IOleControl, riid)) {
69 TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
70 *ppv = &This->IOleControl_iface;
71 }else if(IsEqualGUID(&IID_IPersist, riid)) {
72 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
73 *ppv = &This->IPersistStorage_iface;
74 }else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
75 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
76 *ppv = &This->IPersistStorage_iface;
77 }else if(IsEqualGUID(&IID_IPersistMemory, riid)) {
78 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
79 *ppv = &This->IPersistMemory_iface;
80 }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
81 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
82 *ppv = &This->IPersistStreamInit_iface;
83 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
84 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
85 *ppv = &This->IProvideClassInfo2_iface;
86 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
87 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
88 *ppv = &This->IProvideClassInfo2_iface;
89 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
90 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
91 *ppv = &This->doc_host.cps.IConnectionPointContainer_iface;
92 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
93 TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
94 *ppv = &This->IViewObject2_iface;
95 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
96 TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
97 *ppv = &This->IViewObject2_iface;
98 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
99 TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
100 *ppv = &This->IOleInPlaceActiveObject_iface;
101 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
102 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
103 *ppv = &This->IOleCommandTarget_iface;
104 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
105 *ppv = &This->IServiceProvider_iface;
106 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
107 }else if(IsEqualGUID(&IID_IDataObject, riid)) {
108 *ppv = &This->IDataObject_iface;
109 TRACE("(%p)->(IID_IDataObject %p)\n", This, ppv);
110 }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
111 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
112 return E_NOINTERFACE;
113 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
114 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
115 return E_NOINTERFACE;
116 }else if(IsEqualGUID(&IID_IPerPropertyBrowsing, riid)) {
117 TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This, ppv);
118 return E_NOINTERFACE;
119 }else if(IsEqualGUID(&IID_IOleCache, riid)) {
120 TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This, ppv);
121 return E_NOINTERFACE;
122 }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
123 TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This, ppv);
124 return E_NOINTERFACE;
125 }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
126 TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This, ppv);
127 return E_NOINTERFACE;
128 }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
129 TRACE("(%p)->(IID_IViewObjectEx %p) returning NULL\n", This, ppv);
130 return E_NOINTERFACE;
131 }else if(IsEqualGUID(&IID_IOleLink, riid)) {
132 TRACE("(%p)->(IID_IOleLink %p) returning NULL\n", This, ppv);
133 return E_NOINTERFACE;
134 }else if(IsEqualGUID(&IID_IMarshal, riid)) {
135 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
136 return E_NOINTERFACE;
137 }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
138 /* This is implemented since IE10 */
139 WARN("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
140 return E_NOINTERFACE;
141 }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) {
142 return S_OK;
145 if(*ppv) {
146 IUnknown_AddRef((IUnknown*)*ppv);
147 return S_OK;
150 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
151 return E_NOINTERFACE;
154 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
156 WebBrowser *This = impl_from_IWebBrowser2(iface);
157 LONG ref = InterlockedIncrement(&This->ref);
158 TRACE("(%p) ref=%d\n", This, ref);
159 return ref;
162 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
164 WebBrowser *This = impl_from_IWebBrowser2(iface);
165 LONG ref = InterlockedDecrement(&This->ref);
167 TRACE("(%p) ref=%d\n", This, ref);
169 if(!ref) {
170 if(This->sink)
171 IAdviseSink_Release(This->sink);
173 if(This->doc_host.document)
174 IUnknown_Release(This->doc_host.document);
176 DocHost_Release(&This->doc_host);
178 WebBrowser_OleObject_Destroy(This);
180 heap_free(This);
181 unlock_module();
184 return ref;
187 /* IDispatch methods */
188 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
190 WebBrowser *This = impl_from_IWebBrowser2(iface);
192 TRACE("(%p)->(%p)\n", This, pctinfo);
194 *pctinfo = 1;
195 return S_OK;
198 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
199 LPTYPEINFO *ppTInfo)
201 WebBrowser *This = impl_from_IWebBrowser2(iface);
202 ITypeInfo *typeinfo;
203 HRESULT hres;
205 TRACE("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
207 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
208 if(FAILED(hres))
209 return hres;
211 ITypeInfo_AddRef(typeinfo);
212 *ppTInfo = typeinfo;
213 return S_OK;
216 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
217 LPOLESTR *rgszNames, UINT cNames,
218 LCID lcid, DISPID *rgDispId)
220 WebBrowser *This = impl_from_IWebBrowser2(iface);
221 ITypeInfo *typeinfo;
222 HRESULT hres;
224 TRACE("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
225 lcid, rgDispId);
227 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
228 if(FAILED(hres))
229 return hres;
231 return ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
234 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
235 REFIID riid, LCID lcid, WORD wFlags,
236 DISPPARAMS *pDispParams, VARIANT *pVarResult,
237 EXCEPINFO *pExepInfo, UINT *puArgErr)
239 WebBrowser *This = impl_from_IWebBrowser2(iface);
240 ITypeInfo *typeinfo;
241 HRESULT hres;
243 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
244 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
246 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
247 if(FAILED(hres))
248 return hres;
250 return ITypeInfo_Invoke(typeinfo, &This->IWebBrowser2_iface, dispIdMember, wFlags, pDispParams,
251 pVarResult, pExepInfo, puArgErr);
254 /* IWebBrowser methods */
255 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
257 WebBrowser *This = impl_from_IWebBrowser2(iface);
258 TRACE("(%p)\n", This);
259 return go_back(&This->doc_host);
262 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
264 WebBrowser *This = impl_from_IWebBrowser2(iface);
265 TRACE("(%p)\n", This);
266 return go_forward(&This->doc_host);
269 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
271 WebBrowser *This = impl_from_IWebBrowser2(iface);
272 TRACE("(%p)\n", This);
273 return go_home(&This->doc_host);
276 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
278 WebBrowser *This = impl_from_IWebBrowser2(iface);
279 FIXME("(%p)\n", This);
280 return E_NOTIMPL;
283 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
284 VARIANT *Flags, VARIANT *TargetFrameName,
285 VARIANT *PostData, VARIANT *Headers)
287 WebBrowser *This = impl_from_IWebBrowser2(iface);
289 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(szUrl), debugstr_variant(Flags),
290 debugstr_variant(TargetFrameName), debugstr_variant(PostData),
291 debugstr_variant(Headers));
293 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
296 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
298 WebBrowser *This = impl_from_IWebBrowser2(iface);
300 TRACE("(%p)\n", This);
302 return refresh_document(&This->doc_host, NULL);
305 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
307 WebBrowser *This = impl_from_IWebBrowser2(iface);
309 TRACE("(%p)->(%s)\n", This, debugstr_variant(Level));
311 return refresh_document(&This->doc_host, Level);
314 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
316 WebBrowser *This = impl_from_IWebBrowser2(iface);
317 FIXME("(%p)\n", This);
318 return S_OK;
321 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
323 WebBrowser *This = impl_from_IWebBrowser2(iface);
325 TRACE("(%p)->(%p)\n", This, ppDisp);
327 if(!ppDisp)
328 return E_POINTER;
330 *ppDisp = (IDispatch*)&This->IWebBrowser2_iface;
331 IDispatch_AddRef(*ppDisp);
332 return S_OK;
335 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
337 WebBrowser *This = impl_from_IWebBrowser2(iface);
338 FIXME("(%p)->(%p)\n", This, ppDisp);
339 return E_NOTIMPL;
342 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
344 WebBrowser *This = impl_from_IWebBrowser2(iface);
345 FIXME("(%p)->(%p)\n", This, ppDisp);
346 return E_NOTIMPL;
349 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
351 WebBrowser *This = impl_from_IWebBrowser2(iface);
352 IDispatch *disp = NULL;
354 TRACE("(%p)->(%p)\n", This, ppDisp);
356 if(This->doc_host.document) {
357 HRESULT hres;
359 hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)&disp);
360 if(SUCCEEDED(hres)) {
361 IDispatch *html_doc;
363 /* Some broken apps cast returned IDispatch to IHTMLDocument2
364 * without QueryInterface call */
365 hres = IDispatch_QueryInterface(disp, &IID_IHTMLDocument2, (void**)&html_doc);
366 if(SUCCEEDED(hres)) {
367 IDispatch_Release(disp);
368 disp = html_doc;
373 *ppDisp = disp;
374 return S_OK;
377 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
379 WebBrowser *This = impl_from_IWebBrowser2(iface);
380 FIXME("(%p)->(%p)\n", This, pBool);
381 return E_NOTIMPL;
384 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
386 WebBrowser *This = impl_from_IWebBrowser2(iface);
387 FIXME("(%p)->(%p)\n", This, Type);
388 return E_NOTIMPL;
391 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, LONG *pl)
393 WebBrowser *This = impl_from_IWebBrowser2(iface);
395 TRACE("(%p)->(%p)\n", This, pl);
397 *pl = This->pos_rect.left;
398 return S_OK;
401 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, LONG Left)
403 WebBrowser *This = impl_from_IWebBrowser2(iface);
404 RECT rect;
406 TRACE("(%p)->(%d)\n", This, Left);
408 if(!This->inplace)
409 return E_UNEXPECTED;
411 rect = This->pos_rect;
412 rect.left = Left;
414 /* We don't really change the window position here.
415 * We just notify the embedder that he should do so. */
416 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
419 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, LONG *pl)
421 WebBrowser *This = impl_from_IWebBrowser2(iface);
423 TRACE("(%p)->(%p)\n", This, pl);
425 *pl = This->pos_rect.top;
426 return S_OK;
429 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, LONG Top)
431 WebBrowser *This = impl_from_IWebBrowser2(iface);
432 RECT rect;
434 TRACE("(%p)->(%d)\n", This, Top);
436 if(!This->inplace)
437 return E_UNEXPECTED;
439 rect = This->pos_rect;
440 rect.top = Top;
442 /* We don't really change the window position here.
443 * We just notify the embedder that he should do so. */
444 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
447 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, LONG *pl)
449 WebBrowser *This = impl_from_IWebBrowser2(iface);
451 TRACE("(%p)->(%p)\n", This, pl);
453 *pl = This->pos_rect.right - This->pos_rect.left;
454 return S_OK;
457 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, LONG Width)
459 WebBrowser *This = impl_from_IWebBrowser2(iface);
460 RECT rect;
462 TRACE("(%p)->(%d)\n", This, Width);
464 if(!This->inplace)
465 return E_UNEXPECTED;
467 rect = This->pos_rect;
468 rect.right = rect.left+Width;
470 /* We don't really change the window size here.
471 * We just notify the embedder that he should do so. */
472 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
475 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, LONG *pl)
477 WebBrowser *This = impl_from_IWebBrowser2(iface);
479 TRACE("(%p)->(%p)\n", This, pl);
481 *pl = This->pos_rect.bottom - This->pos_rect.top;
482 return S_OK;
485 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, LONG Height)
487 WebBrowser *This = impl_from_IWebBrowser2(iface);
488 RECT rect;
490 TRACE("(%p)->(%d)\n", This, Height);
492 if(!This->inplace)
493 return E_UNEXPECTED;
495 rect = This->pos_rect;
496 rect.bottom = rect.top+Height;
498 /* We don't really change the window size here.
499 * We just notify the embedder that he should do so. */
500 return IOleInPlaceSiteEx_OnPosRectChange(This->inplace, &rect);
503 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
505 WebBrowser *This = impl_from_IWebBrowser2(iface);
506 FIXME("(%p)->(%p)\n", This, LocationName);
507 return E_NOTIMPL;
510 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
512 WebBrowser *This = impl_from_IWebBrowser2(iface);
514 TRACE("(%p)->(%p)\n", This, LocationURL);
516 return get_location_url(&This->doc_host, LocationURL);
519 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
521 WebBrowser *This = impl_from_IWebBrowser2(iface);
523 TRACE("(%p)->(%p)\n", This, pBool);
525 *pBool = This->doc_host.busy;
526 return S_OK;
529 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
531 WebBrowser *This = impl_from_IWebBrowser2(iface);
533 TRACE("(%p)\n", This);
535 /* It's a InternetExplorer specific method, we have nothing to do here. */
536 return E_FAIL;
539 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
541 WebBrowser *This = impl_from_IWebBrowser2(iface);
542 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
543 return E_NOTIMPL;
546 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
548 WebBrowser *This = impl_from_IWebBrowser2(iface);
549 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(&vtValue));
550 return E_NOTIMPL;
553 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
555 WebBrowser *This = impl_from_IWebBrowser2(iface);
556 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(pvtValue));
557 return E_NOTIMPL;
560 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
562 static const WCHAR sName[] = {'M','i','c','r','o','s','o','f','t',' ','W','e','b',
563 ' ','B','r','o','w','s','e','r',' ','C','o','n','t','r','o','l',0};
564 WebBrowser *This = impl_from_IWebBrowser2(iface);
566 TRACE("(%p)->(%p)\n", This, Name);
568 *Name = SysAllocString(sName);
570 return S_OK;
573 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, SHANDLE_PTR *pHWND)
575 WebBrowser *This = impl_from_IWebBrowser2(iface);
577 TRACE("(%p)->(%p)\n", This, pHWND);
579 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
580 *pHWND = 0;
581 return E_FAIL;
584 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
586 WebBrowser *This = impl_from_IWebBrowser2(iface);
587 FIXME("(%p)->(%p)\n", This, FullName);
588 return E_NOTIMPL;
591 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
593 WebBrowser *This = impl_from_IWebBrowser2(iface);
594 FIXME("(%p)->(%p)\n", This, Path);
595 return E_NOTIMPL;
598 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
600 WebBrowser *This = impl_from_IWebBrowser2(iface);
602 TRACE("(%p)->(%p)\n", This, pBool);
604 *pBool = This->visible;
605 return S_OK;
608 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
610 WebBrowser *This = impl_from_IWebBrowser2(iface);
611 VARIANTARG arg;
612 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
614 TRACE("(%p)->(%x)\n", This, Value);
616 This->visible = Value;
618 V_VT(&arg) = VT_BOOL;
619 V_BOOL(&arg) = Value;
620 call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
622 return S_OK;
625 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
627 WebBrowser *This = impl_from_IWebBrowser2(iface);
629 TRACE("(%p)->(%p)\n", This, pBool);
631 *pBool = This->status_bar;
632 return S_OK;
635 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
637 WebBrowser *This = impl_from_IWebBrowser2(iface);
638 VARIANTARG arg;
639 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
641 TRACE("(%p)->(%x)\n", This, Value);
643 This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
645 /* In opposition to InternetExplorer, all we should do here is
646 * inform the embedder about the status bar change. */
648 V_VT(&arg) = VT_BOOL;
649 V_BOOL(&arg) = Value;
650 call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
652 return S_OK;
655 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
657 WebBrowser *This = impl_from_IWebBrowser2(iface);
658 FIXME("(%p)->(%p)\n", This, StatusText);
659 return E_NOTIMPL;
662 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
664 WebBrowser *This = impl_from_IWebBrowser2(iface);
665 FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
666 return E_NOTIMPL;
669 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
671 WebBrowser *This = impl_from_IWebBrowser2(iface);
673 TRACE("(%p)->(%p)\n", This, Value);
675 *Value = This->tool_bar;
676 return S_OK;
679 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
681 WebBrowser *This = impl_from_IWebBrowser2(iface);
682 VARIANTARG arg;
683 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
685 TRACE("(%p)->(%x)\n", This, Value);
687 This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
689 /* In opposition to InternetExplorer, all we should do here is
690 * inform the embedder about the tool bar change. */
692 V_VT(&arg) = VT_BOOL;
693 V_BOOL(&arg) = This->tool_bar;
694 call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
696 return S_OK;
699 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
701 WebBrowser *This = impl_from_IWebBrowser2(iface);
703 TRACE("(%p)->(%p)\n", This, Value);
705 *Value = This->menu_bar;
706 return S_OK;
709 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
711 WebBrowser *This = impl_from_IWebBrowser2(iface);
712 VARIANTARG arg;
713 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
715 TRACE("(%p)->(%x)\n", This, Value);
717 This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
719 /* In opposition to InternetExplorer, all we should do here is
720 * inform the embedder about the menu bar change. */
722 V_VT(&arg) = VT_BOOL;
723 V_BOOL(&arg) = Value;
724 call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
726 return S_OK;
729 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
731 WebBrowser *This = impl_from_IWebBrowser2(iface);
733 TRACE("(%p)->(%p)\n", This, pbFullScreen);
735 *pbFullScreen = This->full_screen;
736 return S_OK;
739 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
741 WebBrowser *This = impl_from_IWebBrowser2(iface);
742 VARIANTARG arg;
743 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
745 /* In opposition to InternetExplorer, all we should do here is
746 * inform the embedder about the fullscreen change. */
748 TRACE("(%p)->(%x)\n", This, bFullScreen);
750 This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
752 V_VT(&arg) = VT_BOOL;
753 V_BOOL(&arg) = bFullScreen;
754 call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);
756 return S_OK;
759 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
760 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
762 WebBrowser *This = impl_from_IWebBrowser2(iface);
763 LPCWSTR url;
765 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_variant(URL), debugstr_variant(Flags),
766 debugstr_variant(TargetFrameName), debugstr_variant(PostData), debugstr_variant(Headers));
768 if(!This->client)
769 return E_FAIL;
771 if(!URL)
772 return S_OK;
774 switch (V_VT(URL))
776 case VT_BSTR:
777 url = V_BSTR(URL);
778 break;
779 case VT_BSTR|VT_BYREF:
780 url = *V_BSTRREF(URL);
781 break;
782 default:
783 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
784 return E_INVALIDARG;
787 return navigate_url(&This->doc_host, url, Flags, TargetFrameName, PostData, Headers);
790 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
792 WebBrowser *This = impl_from_IWebBrowser2(iface);
793 IOleCommandTarget *target = NULL;
794 OLECMD ole_command[1];
795 HRESULT hres;
797 TRACE("(%p)->(%d %p)\n", This, cmdID, pcmdf);
799 if (!pcmdf)
800 return E_POINTER;
801 ole_command[0].cmdID = cmdID;
802 ole_command[0].cmdf = *pcmdf;
804 if (This->container)
806 hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (LPVOID*)&target);
807 if(FAILED(hres))
808 target = NULL;
810 if (!target && This->doc_host.document)
812 hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target);
813 if(FAILED(hres))
814 target = NULL;
817 if (!target)
818 return E_UNEXPECTED;
820 hres = IOleCommandTarget_QueryStatus(target, NULL, 1, ole_command, NULL);
821 if (SUCCEEDED(hres))
822 *pcmdf = ole_command[0].cmdf;
823 if (hres == OLECMDERR_E_NOTSUPPORTED)
825 *pcmdf = 0;
826 hres = S_OK;
828 IOleCommandTarget_Release(target);
830 return hres;
833 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
834 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
836 WebBrowser *This = impl_from_IWebBrowser2(iface);
837 IOleCommandTarget *target = NULL;
838 HRESULT hres;
840 TRACE("(%p)->(%d %d %s %p)\n", This, cmdID, cmdexecopt, debugstr_variant(pvaIn), pvaOut);
842 if(This->container)
844 hres = IOleContainer_QueryInterface(This->container, &IID_IOleCommandTarget, (LPVOID*)&target);
845 if(FAILED(hres))
846 target = NULL;
848 if(!target && This->doc_host.document)
850 hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (LPVOID*)&target);
851 if(FAILED(hres))
852 target = NULL;
855 if(!target)
856 return E_UNEXPECTED;
858 hres = IOleCommandTarget_Exec(target, NULL, cmdID, cmdexecopt, pvaIn, pvaOut);
859 IOleCommandTarget_Release(target);
861 return hres;
864 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
865 VARIANT *pvarShow, VARIANT *pvarSize)
867 WebBrowser *This = impl_from_IWebBrowser2(iface);
868 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvaClsid), debugstr_variant(pvarShow),
869 debugstr_variant(pvarSize));
870 return E_NOTIMPL;
873 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
875 WebBrowser *This = impl_from_IWebBrowser2(iface);
877 TRACE("(%p)->(%p)\n", This, lpReadyState);
879 *lpReadyState = This->doc_host.ready_state;
880 return S_OK;
883 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
885 WebBrowser *This = impl_from_IWebBrowser2(iface);
887 TRACE("(%p)->(%p)\n", This, pbOffline);
889 *pbOffline = This->doc_host.offline;
890 return S_OK;
893 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
895 WebBrowser *This = impl_from_IWebBrowser2(iface);
897 TRACE("(%p)->(%x)\n", This, bOffline);
899 This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
900 return S_OK;
903 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
905 WebBrowser *This = impl_from_IWebBrowser2(iface);
907 TRACE("(%p)->(%p)\n", This, pbSilent);
909 *pbSilent = This->doc_host.silent;
910 return S_OK;
913 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
915 WebBrowser *This = impl_from_IWebBrowser2(iface);
917 TRACE("(%p)->(%x)\n", This, bSilent);
919 This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
920 return S_OK;
923 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
924 VARIANT_BOOL *pbRegister)
926 WebBrowser *This = impl_from_IWebBrowser2(iface);
928 FIXME("(%p)->(%p)\n", This, pbRegister);
930 *pbRegister = This->register_browser;
931 return S_OK;
934 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
935 VARIANT_BOOL bRegister)
937 WebBrowser *This = impl_from_IWebBrowser2(iface);
939 FIXME("(%p)->(%x)\n", This, bRegister);
941 This->register_browser = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
942 return S_OK;
945 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
946 VARIANT_BOOL *pbRegister)
948 WebBrowser *This = impl_from_IWebBrowser2(iface);
950 FIXME("(%p)->(%p)\n", This, pbRegister);
952 if(!pbRegister)
953 return E_INVALIDARG;
955 *pbRegister=0;
956 return S_OK;
959 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
960 VARIANT_BOOL bRegister)
962 WebBrowser *This = impl_from_IWebBrowser2(iface);
963 FIXME("(%p)->(%x)\n", This, bRegister);
964 return S_OK;
967 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
969 WebBrowser *This = impl_from_IWebBrowser2(iface);
971 TRACE("(%p)->(%p)\n", This, pbRegister);
973 *pbRegister = This->theater_mode;
974 return S_OK;
977 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
979 WebBrowser *This = impl_from_IWebBrowser2(iface);
980 VARIANTARG arg;
981 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
983 TRACE("(%p)->(%x)\n", This, bRegister);
985 This->theater_mode = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
987 /* In opposition to InternetExplorer, all we should do here is
988 * inform the embedder about the theater mode change. */
990 V_VT(&arg) = VT_BOOL;
991 V_BOOL(&arg) = bRegister;
992 call_sink(This->doc_host.cps.wbe2, DISPID_ONTHEATERMODE, &dispparams);
994 return S_OK;
997 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
999 WebBrowser *This = impl_from_IWebBrowser2(iface);
1001 TRACE("(%p)->(%p)\n", This, Value);
1003 *Value = This->address_bar;
1004 return S_OK;
1007 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
1009 WebBrowser *This = impl_from_IWebBrowser2(iface);
1010 VARIANTARG arg;
1011 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
1013 TRACE("(%p)->(%x)\n", This, Value);
1015 This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
1017 /* In opposition to InternetExplorer, all we should do here is
1018 * inform the embedder about the address bar change. */
1020 V_VT(&arg) = VT_BOOL;
1021 V_BOOL(&arg) = Value;
1022 call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
1024 return S_OK;
1027 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
1029 WebBrowser *This = impl_from_IWebBrowser2(iface);
1031 TRACE("(%p)->(%p)\n", This, Value);
1033 /* It's InternetExplorer object's method. We have nothing to do here. */
1034 return E_NOTIMPL;
1037 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
1039 WebBrowser *This = impl_from_IWebBrowser2(iface);
1040 VARIANTARG arg;
1041 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
1043 TRACE("(%p)->(%x)\n", This, Value);
1045 /* In opposition to InternetExplorer, all we should do here is
1046 * inform the embedder about the resizable change. */
1048 V_VT(&arg) = VT_BOOL;
1049 V_BOOL(&arg) = Value;
1050 call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);
1052 return S_OK;
1055 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
1057 WebBrowser_QueryInterface,
1058 WebBrowser_AddRef,
1059 WebBrowser_Release,
1060 WebBrowser_GetTypeInfoCount,
1061 WebBrowser_GetTypeInfo,
1062 WebBrowser_GetIDsOfNames,
1063 WebBrowser_Invoke,
1064 WebBrowser_GoBack,
1065 WebBrowser_GoForward,
1066 WebBrowser_GoHome,
1067 WebBrowser_GoSearch,
1068 WebBrowser_Navigate,
1069 WebBrowser_Refresh,
1070 WebBrowser_Refresh2,
1071 WebBrowser_Stop,
1072 WebBrowser_get_Application,
1073 WebBrowser_get_Parent,
1074 WebBrowser_get_Container,
1075 WebBrowser_get_Document,
1076 WebBrowser_get_TopLevelContainer,
1077 WebBrowser_get_Type,
1078 WebBrowser_get_Left,
1079 WebBrowser_put_Left,
1080 WebBrowser_get_Top,
1081 WebBrowser_put_Top,
1082 WebBrowser_get_Width,
1083 WebBrowser_put_Width,
1084 WebBrowser_get_Height,
1085 WebBrowser_put_Height,
1086 WebBrowser_get_LocationName,
1087 WebBrowser_get_LocationURL,
1088 WebBrowser_get_Busy,
1089 WebBrowser_Quit,
1090 WebBrowser_ClientToWindow,
1091 WebBrowser_PutProperty,
1092 WebBrowser_GetProperty,
1093 WebBrowser_get_Name,
1094 WebBrowser_get_HWND,
1095 WebBrowser_get_FullName,
1096 WebBrowser_get_Path,
1097 WebBrowser_get_Visible,
1098 WebBrowser_put_Visible,
1099 WebBrowser_get_StatusBar,
1100 WebBrowser_put_StatusBar,
1101 WebBrowser_get_StatusText,
1102 WebBrowser_put_StatusText,
1103 WebBrowser_get_ToolBar,
1104 WebBrowser_put_ToolBar,
1105 WebBrowser_get_MenuBar,
1106 WebBrowser_put_MenuBar,
1107 WebBrowser_get_FullScreen,
1108 WebBrowser_put_FullScreen,
1109 WebBrowser_Navigate2,
1110 WebBrowser_QueryStatusWB,
1111 WebBrowser_ExecWB,
1112 WebBrowser_ShowBrowserBar,
1113 WebBrowser_get_ReadyState,
1114 WebBrowser_get_Offline,
1115 WebBrowser_put_Offline,
1116 WebBrowser_get_Silent,
1117 WebBrowser_put_Silent,
1118 WebBrowser_get_RegisterAsBrowser,
1119 WebBrowser_put_RegisterAsBrowser,
1120 WebBrowser_get_RegisterAsDropTarget,
1121 WebBrowser_put_RegisterAsDropTarget,
1122 WebBrowser_get_TheaterMode,
1123 WebBrowser_put_TheaterMode,
1124 WebBrowser_get_AddressBar,
1125 WebBrowser_put_AddressBar,
1126 WebBrowser_get_Resizable,
1127 WebBrowser_put_Resizable
1130 static inline WebBrowser *impl_from_IServiceProvider(IServiceProvider *iface)
1132 return CONTAINING_RECORD(iface, WebBrowser, IServiceProvider_iface);
1135 static HRESULT WINAPI WBServiceProvider_QueryInterface(IServiceProvider *iface,
1136 REFIID riid, LPVOID *ppv)
1138 WebBrowser *This = impl_from_IServiceProvider(iface);
1139 return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
1142 static ULONG WINAPI WBServiceProvider_AddRef(IServiceProvider *iface)
1144 WebBrowser *This = impl_from_IServiceProvider(iface);
1145 return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
1148 static ULONG WINAPI WBServiceProvider_Release(IServiceProvider *iface)
1150 WebBrowser *This = impl_from_IServiceProvider(iface);
1151 return IWebBrowser2_Release(&This->IWebBrowser2_iface);
1154 static HRESULT STDMETHODCALLTYPE WBServiceProvider_QueryService(IServiceProvider *iface,
1155 REFGUID guidService, REFIID riid, void **ppv)
1157 WebBrowser *This = impl_from_IServiceProvider(iface);
1159 if(IsEqualGUID(&SID_SHTMLWindow, riid)) {
1160 TRACE("(%p)->(SID_SHTMLWindow)\n", This);
1161 return IHTMLWindow2_QueryInterface(&This->doc_host.html_window.IHTMLWindow2_iface, riid, ppv);
1164 if(IsEqualGUID(&IID_IBrowserService2, riid)) {
1165 TRACE("(%p)->(IID_IBrowserService2 return E_FAIL)\n", This);
1166 *ppv = NULL;
1167 return E_FAIL;
1170 FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
1171 *ppv = NULL;
1172 return E_NOINTERFACE;
1175 static const IServiceProviderVtbl ServiceProviderVtbl =
1177 WBServiceProvider_QueryInterface,
1178 WBServiceProvider_AddRef,
1179 WBServiceProvider_Release,
1180 WBServiceProvider_QueryService
1183 static inline WebBrowser *impl_from_DocHost(DocHost *iface)
1185 return CONTAINING_RECORD(iface, WebBrowser, doc_host);
1188 static ULONG WebBrowser_addref(DocHost *iface)
1190 WebBrowser *This = impl_from_DocHost(iface);
1191 return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
1194 static ULONG WebBrowser_release(DocHost *iface)
1196 WebBrowser *This = impl_from_DocHost(iface);
1197 return IWebBrowser2_Release(&This->IWebBrowser2_iface);
1200 static void DocHostContainer_get_docobj_rect(DocHost *This, RECT *rc)
1202 GetClientRect(This->frame_hwnd, rc);
1205 static HRESULT DocHostContainer_set_status_text(DocHost *This, const WCHAR *text)
1207 return E_NOTIMPL;
1210 static void DocHostContainer_on_command_state_change(DocHost *This, LONG command, BOOL enable)
1214 static void DocHostContainer_set_url(DocHost *This, const WCHAR *url)
1218 static const IDocHostContainerVtbl DocHostContainerVtbl = {
1219 WebBrowser_addref,
1220 WebBrowser_release,
1221 DocHostContainer_get_docobj_rect,
1222 DocHostContainer_set_status_text,
1223 DocHostContainer_on_command_state_change,
1224 DocHostContainer_set_url
1227 static HRESULT create_webbrowser(int version, IUnknown *outer, REFIID riid, void **ppv)
1229 WebBrowser *ret;
1230 HRESULT hres;
1232 TRACE("(%p %s %p) version=%d\n", outer, debugstr_guid(riid), ppv, version);
1234 ret = heap_alloc_zero(sizeof(WebBrowser));
1236 ret->IWebBrowser2_iface.lpVtbl = &WebBrowser2Vtbl;
1237 ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
1238 ret->ref = 1;
1239 ret->version = version;
1241 DocHost_Init(&ret->doc_host, &ret->IWebBrowser2_iface, &DocHostContainerVtbl);
1243 ret->visible = VARIANT_TRUE;
1244 ret->menu_bar = VARIANT_TRUE;
1245 ret->address_bar = VARIANT_TRUE;
1246 ret->status_bar = VARIANT_TRUE;
1247 ret->tool_bar = VARIANT_TRUE;
1249 WebBrowser_OleObject_Init(ret);
1250 WebBrowser_ViewObject_Init(ret);
1251 WebBrowser_Persist_Init(ret);
1252 WebBrowser_ClassInfo_Init(ret);
1254 HlinkFrame_Init(&ret->hlink_frame, (IUnknown*)&ret->IWebBrowser2_iface, &ret->doc_host);
1256 lock_module();
1258 hres = IWebBrowser2_QueryInterface(&ret->IWebBrowser2_iface, riid, ppv);
1260 IWebBrowser2_Release(&ret->IWebBrowser2_iface);
1261 return hres;
1264 HRESULT WINAPI WebBrowserV1_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
1266 return create_webbrowser(1, pOuter, riid, ppv);
1269 HRESULT WINAPI WebBrowser_Create(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppv)
1271 return create_webbrowser(2, pOuter, riid, ppv);