2 * Implementation of IOleObject interfaces for WebBrowser control
8 * Copyright 2001 John R. Sheets (for CodeWeavers)
9 * Copyright 2005 Jacek Caban
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
33 static ATOM shell_embedding_atom = 0;
35 static LRESULT resize_window(WebBrowser *This, LONG width, LONG height)
37 if(This->doc_host.hwnd)
38 SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height,
39 SWP_NOZORDER | SWP_NOACTIVATE);
44 static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
48 static const WCHAR wszTHIS[] = {'T','H','I','S',0};
50 if(msg == WM_CREATE) {
51 This = *(WebBrowser**)lParam;
52 SetPropW(hwnd, wszTHIS, This);
54 This = GetPropW(hwnd, wszTHIS);
59 return resize_window(This, LOWORD(lParam), HIWORD(lParam));
62 return DefWindowProcW(hwnd, msg, wParam, lParam);
65 static void create_shell_embedding_hwnd(WebBrowser *This)
67 IOleInPlaceSite *inplace;
71 static const WCHAR wszShellEmbedding[] =
72 {'S','h','e','l','l',' ','E','m','b','e','d','d','i','n','g',0};
74 if(!shell_embedding_atom) {
75 static WNDCLASSEXW wndclass = {
79 0, 0 /* native uses 8 */, NULL, NULL, NULL,
80 (HBRUSH)COLOR_WINDOWFRAME, NULL,
84 wndclass.hInstance = shdocvw_hinstance;
86 RegisterClassExW(&wndclass);
89 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleInPlaceSite, (void**)&inplace);
91 IOleInPlaceSite_GetWindow(inplace, &parent);
92 IOleInPlaceSite_Release(inplace);
95 This->doc_host.frame_hwnd = This->shell_embedding_hwnd = CreateWindowExW(
97 wszShellEmbedding, wszShellEmbedding,
98 WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
100 NULL, shdocvw_hinstance, This);
103 static HRESULT activate_inplace(WebBrowser *This, IOleClientSite *active_site, HWND parent_hwnd)
113 hres = IOleClientSite_QueryInterface(active_site, &IID_IOleInPlaceSite,
114 (void**)&This->inplace);
116 WARN("Could not get IOleInPlaceSite\n");
120 hres = IOleInPlaceSite_CanInPlaceActivate(This->inplace);
122 WARN("CanInPlaceActivate returned: %08lx\n", hres);
123 IOleInPlaceSite_Release(This->inplace);
127 hres = IOleInPlaceSite_GetWindow(This->inplace, &This->iphwnd);
129 This->iphwnd = parent_hwnd;
131 IOleInPlaceSite_OnInPlaceActivate(This->inplace);
133 IOleInPlaceSite_GetWindowContext(This->inplace, &This->frame, &This->uiwindow,
134 &This->pos_rect, &This->clip_rect,
137 SetWindowPos(This->shell_embedding_hwnd, NULL,
138 This->pos_rect.left, This->pos_rect.top,
139 This->pos_rect.right-This->pos_rect.left,
140 This->pos_rect.bottom-This->pos_rect.top,
141 SWP_NOZORDER | SWP_SHOWWINDOW);
144 IOleClientSite_ShowObject(This->client);
145 IOleClientSite_GetContainer(This->client, &This->container);
149 IOleInPlaceFrame_GetWindow(This->frame, &This->frame_hwnd);
154 static HRESULT activate_ui(WebBrowser *This, IOleClientSite *active_site, HWND parent_hwnd)
158 static const WCHAR wszitem[] = {'i','t','e','m',0};
163 hres = activate_inplace(This, active_site, parent_hwnd);
167 IOleInPlaceSite_OnUIActivate(This->inplace);
170 IOleInPlaceFrame_SetActiveObject(This->frame, ACTIVEOBJ(This), wszitem);
172 IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, ACTIVEOBJ(This), wszitem);
175 IOleInPlaceFrame_SetMenu(This->frame, NULL, NULL, This->shell_embedding_hwnd);
177 SetFocus(This->shell_embedding_hwnd);
182 /**********************************************************************
183 * Implement the IOleObject interface for the WebBrowser control
186 #define OLEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
188 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
190 WebBrowser *This = OLEOBJ_THIS(iface);
191 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppv);
194 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
196 WebBrowser *This = OLEOBJ_THIS(iface);
197 return IWebBrowser_AddRef(WEBBROWSER(This));
200 static ULONG WINAPI OleObject_Release(IOleObject *iface)
202 WebBrowser *This = OLEOBJ_THIS(iface);
203 return IWebBrowser_Release(WEBBROWSER(This));
206 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
208 WebBrowser *This = OLEOBJ_THIS(iface);
209 IOleContainer *container;
212 TRACE("(%p)->(%p)\n", This, pClientSite);
214 if(This->client == pClientSite)
217 if(This->doc_host.hwnd) {
218 DestroyWindow(This->doc_host.hwnd);
219 This->doc_host.hwnd = NULL;
221 if(This->shell_embedding_hwnd) {
222 DestroyWindow(This->shell_embedding_hwnd);
223 This->shell_embedding_hwnd = NULL;
227 IOleInPlaceSite_Release(This->inplace);
228 This->inplace = NULL;
231 if(This->doc_host.hostui)
232 IDocHostUIHandler_Release(This->doc_host.hostui);
234 IOleClientSite_Release(This->client);
237 if(This->doc_host.document)
238 deactivate_document(&This->doc_host);
243 This->client = pClientSite;
244 IOleClientSite_AddRef(pClientSite);
246 hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
247 (void**)&This->doc_host.hostui);
249 This->doc_host.hostui = NULL;
251 hres = IOleClientSite_GetContainer(This->client, &container);
252 if(SUCCEEDED(hres)) {
253 ITargetContainer *target_container;
255 hres = IOleContainer_QueryInterface(container, &IID_ITargetContainer,
256 (void**)&target_container);
257 if(SUCCEEDED(hres)) {
258 FIXME("Unsupported ITargetContainer\n");
259 ITargetContainer_Release(target_container);
262 IOleContainer_Release(container);
265 create_shell_embedding_hwnd(This);
270 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, LPOLECLIENTSITE *ppClientSite)
272 WebBrowser *This = OLEOBJ_THIS(iface);
274 TRACE("(%p)->(%p)\n", This, ppClientSite);
280 IOleClientSite_AddRef(This->client);
281 *ppClientSite = This->client;
286 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp,
287 LPCOLESTR szContainerObj)
289 WebBrowser *This = OLEOBJ_THIS(iface);
290 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
294 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
296 WebBrowser *This = OLEOBJ_THIS(iface);
297 FIXME("(%p)->(%ld)\n", This, dwSaveOption);
301 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
303 WebBrowser *This = OLEOBJ_THIS(iface);
304 FIXME("(%p)->(%ld, %p)\n", This, dwWhichMoniker, pmk);
308 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign,
309 DWORD dwWhichMoniker, LPMONIKER *ppmk)
311 WebBrowser *This = OLEOBJ_THIS(iface);
312 FIXME("(%p)->(%ld, %ld, %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
316 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, LPDATAOBJECT pDataObject,
317 BOOL fCreation, DWORD dwReserved)
319 WebBrowser *This = OLEOBJ_THIS(iface);
320 FIXME("(%p)->(%p, %d, %ld)\n", This, pDataObject, fCreation, dwReserved);
324 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved,
325 LPDATAOBJECT *ppDataObject)
327 WebBrowser *This = OLEOBJ_THIS(iface);
328 FIXME("(%p)->(%ld, %p)\n", This, dwReserved, ppDataObject);
332 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tagMSG* lpmsg,
333 LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
335 WebBrowser *This = OLEOBJ_THIS(iface);
337 TRACE("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
343 TRACE("OLEIVERB_SHOW\n");
344 return activate_ui(This, pActiveSite, hwndParent);
345 case OLEIVERB_UIACTIVATE:
346 TRACE("OLEIVERB_UIACTIVATE\n");
347 return activate_ui(This, pActiveSite, hwndParent);
348 case OLEIVERB_INPLACEACTIVATE:
349 TRACE("OLEIVERB_INPLACEACTIVATE\n");
350 return activate_inplace(This, pActiveSite, hwndParent);
352 FIXME("stub for %ld\n", iVerb);
359 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
361 WebBrowser *This = OLEOBJ_THIS(iface);
362 TRACE("(%p)->(%p)\n", This, ppEnumOleVerb);
363 return OleRegEnumVerbs(&CLSID_WebBrowser, ppEnumOleVerb);
366 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
368 WebBrowser *This = OLEOBJ_THIS(iface);
369 FIXME("(%p)\n", This);
373 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
375 WebBrowser *This = OLEOBJ_THIS(iface);
376 FIXME("(%p)\n", This);
380 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID* pClsid)
382 WebBrowser *This = OLEOBJ_THIS(iface);
383 FIXME("(%p)->(%p)\n", This, pClsid);
387 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType,
388 LPOLESTR* pszUserType)
390 WebBrowser *This = OLEOBJ_THIS(iface);
391 TRACE("(%p, %ld, %p)\n", This, dwFormOfType, pszUserType);
392 return OleRegGetUserType(&CLSID_WebBrowser, dwFormOfType, pszUserType);
395 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
397 WebBrowser *This = OLEOBJ_THIS(iface);
398 FIXME("(%p)->(%lx %p)\n", This, dwDrawAspect, psizel);
402 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
404 WebBrowser *This = OLEOBJ_THIS(iface);
405 FIXME("(%p)->(%lx, %p)\n", This, dwDrawAspect, psizel);
409 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
410 DWORD* pdwConnection)
412 WebBrowser *This = OLEOBJ_THIS(iface);
413 FIXME("(%p)->(%p, %p)\n", This, pAdvSink, pdwConnection);
417 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
419 WebBrowser *This = OLEOBJ_THIS(iface);
420 FIXME("(%p)->(%ld)\n", This, dwConnection);
424 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
426 WebBrowser *This = OLEOBJ_THIS(iface);
427 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
431 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
433 WebBrowser *This = OLEOBJ_THIS(iface);
435 TRACE("(%p)->(%lx, %p)\n", This, dwAspect, pdwStatus);
437 *pdwStatus = OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT
438 |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE;
443 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE* pLogpal)
445 WebBrowser *This = OLEOBJ_THIS(iface);
446 FIXME("(%p)->(%p)\n", This, pLogpal);
452 static const IOleObjectVtbl OleObjectVtbl =
454 OleObject_QueryInterface,
457 OleObject_SetClientSite,
458 OleObject_GetClientSite,
459 OleObject_SetHostNames,
461 OleObject_SetMoniker,
462 OleObject_GetMoniker,
463 OleObject_InitFromData,
464 OleObject_GetClipboardData,
468 OleObject_IsUpToDate,
469 OleObject_GetUserClassID,
470 OleObject_GetUserType,
475 OleObject_EnumAdvise,
476 OleObject_GetMiscStatus,
477 OleObject_SetColorScheme
480 /**********************************************************************
481 * Implement the IOleInPlaceObject interface
484 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
486 static HRESULT WINAPI OleInPlaceObject_QueryInterface(IOleInPlaceObject *iface,
487 REFIID riid, LPVOID *ppobj)
489 WebBrowser *This = INPLACEOBJ_THIS(iface);
490 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
493 static ULONG WINAPI OleInPlaceObject_AddRef(IOleInPlaceObject *iface)
495 WebBrowser *This = INPLACEOBJ_THIS(iface);
496 return IWebBrowser_AddRef(WEBBROWSER(This));
499 static ULONG WINAPI OleInPlaceObject_Release(IOleInPlaceObject *iface)
501 WebBrowser *This = INPLACEOBJ_THIS(iface);
502 return IWebBrowser_Release(WEBBROWSER(This));
505 static HRESULT WINAPI OleInPlaceObject_GetWindow(IOleInPlaceObject *iface, HWND* phwnd)
507 WebBrowser *This = INPLACEOBJ_THIS(iface);
509 TRACE("(%p)->(%p)\n", This, phwnd);
511 *phwnd = This->shell_embedding_hwnd;
515 static HRESULT WINAPI OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject *iface,
518 WebBrowser *This = INPLACEOBJ_THIS(iface);
519 FIXME("(%p)->(%x)\n", This, fEnterMode);
523 static HRESULT WINAPI OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject *iface)
525 WebBrowser *This = INPLACEOBJ_THIS(iface);
526 FIXME("(%p)\n", This);
530 static HRESULT WINAPI OleInPlaceObject_UIDeactivate(IOleInPlaceObject *iface)
532 WebBrowser *This = INPLACEOBJ_THIS(iface);
533 FIXME("(%p)\n", This);
537 static HRESULT WINAPI OleInPlaceObject_SetObjectRects(IOleInPlaceObject *iface,
538 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
540 WebBrowser *This = INPLACEOBJ_THIS(iface);
542 TRACE("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
544 memcpy(&This->pos_rect, lprcPosRect, sizeof(RECT));
547 memcpy(&This->clip_rect, lprcClipRect, sizeof(RECT));
549 if(This->shell_embedding_hwnd) {
550 SetWindowPos(This->shell_embedding_hwnd, NULL,
551 lprcPosRect->left, lprcPosRect->top,
552 lprcPosRect->right-lprcPosRect->left,
553 lprcPosRect->bottom-lprcPosRect->top,
554 SWP_NOZORDER | SWP_NOACTIVATE);
560 static HRESULT WINAPI OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject *iface)
562 WebBrowser *This = INPLACEOBJ_THIS(iface);
563 FIXME("(%p)\n", This);
567 #undef INPLACEOBJ_THIS
569 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl =
571 OleInPlaceObject_QueryInterface,
572 OleInPlaceObject_AddRef,
573 OleInPlaceObject_Release,
574 OleInPlaceObject_GetWindow,
575 OleInPlaceObject_ContextSensitiveHelp,
576 OleInPlaceObject_InPlaceDeactivate,
577 OleInPlaceObject_UIDeactivate,
578 OleInPlaceObject_SetObjectRects,
579 OleInPlaceObject_ReactivateAndUndo
582 /**********************************************************************
583 * Implement the IOleControl interface
586 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
588 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface,
589 REFIID riid, LPVOID *ppobj)
591 WebBrowser *This = CONTROL_THIS(iface);
592 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
595 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
597 WebBrowser *This = CONTROL_THIS(iface);
598 return IWebBrowser_AddRef(WEBBROWSER(This));
601 static ULONG WINAPI OleControl_Release(IOleControl *iface)
603 WebBrowser *This = CONTROL_THIS(iface);
604 return IWebBrowser_Release(WEBBROWSER(This));
607 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI)
609 WebBrowser *This = CONTROL_THIS(iface);
610 FIXME("(%p)->(%p)\n", This, pCI);
614 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, struct tagMSG *pMsg)
616 WebBrowser *This = CONTROL_THIS(iface);
617 FIXME("(%p)->(%p)\n", This, pMsg);
621 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
623 WebBrowser *This = CONTROL_THIS(iface);
624 FIXME("(%p)->(%ld)\n", This, dispID);
628 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
630 WebBrowser *This = CONTROL_THIS(iface);
631 FIXME("(%p)->(%x)\n", This, bFreeze);
637 static const IOleControlVtbl OleControlVtbl =
639 OleControl_QueryInterface,
642 OleControl_GetControlInfo,
643 OleControl_OnMnemonic,
644 OleControl_OnAmbientPropertyChange,
645 OleControl_FreezeEvents
648 #define ACTIVEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceActiveObject, iface)
650 static HRESULT WINAPI InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface,
651 REFIID riid, void **ppv)
653 WebBrowser *This = ACTIVEOBJ_THIS(iface);
654 return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv);
657 static ULONG WINAPI InPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
659 WebBrowser *This = ACTIVEOBJ_THIS(iface);
660 return IWebBrowser2_AddRef(WEBBROWSER2(This));
663 static ULONG WINAPI InPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
665 WebBrowser *This = ACTIVEOBJ_THIS(iface);
666 return IWebBrowser2_Release(WEBBROWSER2(This));
669 static HRESULT WINAPI InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface,
672 WebBrowser *This = ACTIVEOBJ_THIS(iface);
673 return IOleInPlaceObject_GetWindow(INPLACEOBJ(This), phwnd);
676 static HRESULT WINAPI InPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface,
679 WebBrowser *This = ACTIVEOBJ_THIS(iface);
680 return IOleInPlaceObject_ContextSensitiveHelp(INPLACEOBJ(This), fEnterMode);
683 static HRESULT WINAPI InPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface,
686 WebBrowser *This = ACTIVEOBJ_THIS(iface);
687 FIXME("(%p)->(%p)\n", This, lpmsg);
691 static HRESULT WINAPI InPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
694 WebBrowser *This = ACTIVEOBJ_THIS(iface);
695 FIXME("(%p)->(%x)\n", This, fActivate);
699 static HRESULT WINAPI InPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface,
702 WebBrowser *This = ACTIVEOBJ_THIS(iface);
703 FIXME("(%p)->(%x)\n", This, fActivate);
707 static HRESULT WINAPI InPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface,
708 LPCRECT lprcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
710 WebBrowser *This = ACTIVEOBJ_THIS(iface);
711 FIXME("(%p)->(%p %p %x)\n", This, lprcBorder, pUIWindow, fFrameWindow);
715 static HRESULT WINAPI InPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface,
718 WebBrowser *This = ACTIVEOBJ_THIS(iface);
719 FIXME("(%p)->(%x)\n", This, fEnable);
723 #undef ACTIVEOBJ_THIS
725 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
726 InPlaceActiveObject_QueryInterface,
727 InPlaceActiveObject_AddRef,
728 InPlaceActiveObject_Release,
729 InPlaceActiveObject_GetWindow,
730 InPlaceActiveObject_ContextSensitiveHelp,
731 InPlaceActiveObject_TranslateAccelerator,
732 InPlaceActiveObject_OnFrameWindowActivate,
733 InPlaceActiveObject_OnDocWindowActivate,
734 InPlaceActiveObject_ResizeBorder,
735 InPlaceActiveObject_EnableModeless
738 #define OLECMD_THIS(iface) DEFINE_THIS(WebBrowser, OleCommandTarget, iface)
740 static HRESULT WINAPI WBOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
741 REFIID riid, void **ppv)
743 WebBrowser *This = OLECMD_THIS(iface);
744 return IWebBrowser2_QueryInterface(WEBBROWSER(This), riid, ppv);
747 static ULONG WINAPI WBOleCommandTarget_AddRef(IOleCommandTarget *iface)
749 WebBrowser *This = OLECMD_THIS(iface);
750 return IWebBrowser2_AddRef(WEBBROWSER(This));
753 static ULONG WINAPI WBOleCommandTarget_Release(IOleCommandTarget *iface)
755 WebBrowser *This = OLECMD_THIS(iface);
756 return IWebBrowser2_Release(WEBBROWSER(This));
759 static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
760 const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
762 WebBrowser *This = OLECMD_THIS(iface);
763 FIXME("(%p)->(%s %lu %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
768 static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface,
769 const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
772 WebBrowser *This = OLECMD_THIS(iface);
773 FIXME("(%p)->(%s %ld %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
774 nCmdexecopt, pvaIn, pvaOut);
780 static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
781 WBOleCommandTarget_QueryInterface,
782 WBOleCommandTarget_AddRef,
783 WBOleCommandTarget_Release,
784 WBOleCommandTarget_QueryStatus,
785 WBOleCommandTarget_Exec
788 void WebBrowser_OleObject_Init(WebBrowser *This)
790 This->lpOleObjectVtbl = &OleObjectVtbl;
791 This->lpOleInPlaceObjectVtbl = &OleInPlaceObjectVtbl;
792 This->lpOleControlVtbl = &OleControlVtbl;
793 This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
794 This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
797 This->inplace = NULL;
798 This->container = NULL;
800 This->frame_hwnd = NULL;
802 This->uiwindow = NULL;
803 This->shell_embedding_hwnd = NULL;
805 memset(&This->pos_rect, 0, sizeof(RECT));
806 memset(&This->clip_rect, 0, sizeof(RECT));
807 memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
810 void WebBrowser_OleObject_Destroy(WebBrowser *This)
813 IOleObject_SetClientSite(OLEOBJ(This), NULL);
815 IOleContainer_Release(This->container);
817 IOleInPlaceFrame_Release(This->frame);
819 IOleInPlaceUIWindow_Release(This->uiwindow);