2 * WebBrowser Implementation
4 * Copyright 2005 James Hawkins
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp
);
28 static inline WebBrowserContainer
*impl_from_IOleClientSite(IOleClientSite
*iface
)
30 return CONTAINING_RECORD(iface
, WebBrowserContainer
, IOleClientSite_iface
);
33 static HRESULT STDMETHODCALLTYPE
Site_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppvObj
)
35 WebBrowserContainer
*This
= impl_from_IOleClientSite(iface
);
37 if (IsEqualIID(riid
, &IID_IUnknown
)) {
38 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppvObj
);
39 *ppvObj
= &This
->IOleClientSite_iface
;
40 }else if(IsEqualIID(riid
, &IID_IOleClientSite
)) {
41 TRACE("(%p)->(IID_IOleClientSite %p)\n", This
, ppvObj
);
42 *ppvObj
= &This
->IOleClientSite_iface
;
43 }else if (IsEqualIID(riid
, &IID_IOleInPlaceSite
)) {
44 TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This
, ppvObj
);
45 *ppvObj
= &This
->IOleInPlaceSite_iface
;
46 }else if (IsEqualIID(riid
, &IID_IOleInPlaceFrame
)) {
47 TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This
, ppvObj
);
48 *ppvObj
= &This
->IOleInPlaceSite_iface
;
49 }else if (IsEqualIID(riid
, &IID_IDocHostUIHandler
)) {
50 TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This
, ppvObj
);
51 *ppvObj
= &This
->IDocHostUIHandler_iface
;
53 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObj
);
58 IUnknown_AddRef((IUnknown
*)*ppvObj
);
62 static ULONG STDMETHODCALLTYPE
Site_AddRef(IOleClientSite
*iface
)
64 WebBrowserContainer
*This
= impl_from_IOleClientSite(iface
);
65 LONG ref
= InterlockedIncrement(&This
->ref
);
67 TRACE("(%p) ref=%d\n", This
, ref
);
72 static ULONG STDMETHODCALLTYPE
Site_Release(IOleClientSite
*iface
)
74 WebBrowserContainer
*This
= impl_from_IOleClientSite(iface
);
75 LONG ref
= InterlockedDecrement(&This
->ref
);
77 TRACE("(%p) ref=%d\n", This
, ref
);
81 IOleObject_Release(This
->ole_obj
);
83 IWebBrowser2_Release(This
->web_browser
);
90 static HRESULT STDMETHODCALLTYPE
Site_SaveObject(IOleClientSite
*iface
)
95 static HRESULT STDMETHODCALLTYPE
Site_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
100 static HRESULT STDMETHODCALLTYPE
Site_GetContainer(IOleClientSite
*iface
, LPOLECONTAINER
*ppContainer
)
104 return E_NOINTERFACE
;
107 static HRESULT STDMETHODCALLTYPE
Site_ShowObject(IOleClientSite
*iface
)
112 static HRESULT STDMETHODCALLTYPE
Site_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
117 static HRESULT STDMETHODCALLTYPE
Site_RequestNewObjectLayout(IOleClientSite
*iface
)
122 static const IOleClientSiteVtbl OleClientSiteVtbl
=
132 Site_RequestNewObjectLayout
135 static inline WebBrowserContainer
*impl_from_IDocHostUIHandler(IDocHostUIHandler
*iface
)
137 return CONTAINING_RECORD(iface
, WebBrowserContainer
, IDocHostUIHandler_iface
);
140 static HRESULT STDMETHODCALLTYPE
UI_QueryInterface(IDocHostUIHandler
*iface
, REFIID riid
, LPVOID
*ppvObj
)
142 WebBrowserContainer
*This
= impl_from_IDocHostUIHandler(iface
);
144 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
147 static ULONG STDMETHODCALLTYPE
UI_AddRef(IDocHostUIHandler
*iface
)
149 WebBrowserContainer
*This
= impl_from_IDocHostUIHandler(iface
);
151 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
154 static ULONG STDMETHODCALLTYPE
UI_Release(IDocHostUIHandler
* iface
)
156 WebBrowserContainer
*This
= impl_from_IDocHostUIHandler(iface
);
158 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
161 static HRESULT STDMETHODCALLTYPE
UI_ShowContextMenu(IDocHostUIHandler
*iface
, DWORD dwID
, POINT
*ppt
, IUnknown
*pcmdtReserved
, IDispatch
*pdispReserved
)
163 WebBrowserContainer
*This
= impl_from_IDocHostUIHandler(iface
);
164 DWORD cmdid
, menu_id
= 0;
167 TRACE("(%p)->(%d %s)\n", This
, dwID
, wine_dbgstr_point(ppt
));
169 menu
= LoadMenuW(hhctrl_hinstance
, MAKEINTRESOURCEW(MENU_WEBBROWSER
));
173 /* FIXME: Support more menu types. */
174 if(dwID
== CONTEXT_MENU_TEXTSELECT
)
177 submenu
= GetSubMenu(menu
, menu_id
);
179 cmdid
= TrackPopupMenu(submenu
, TPM_LEFTALIGN
| TPM_RIGHTBUTTON
| TPM_RETURNCMD
,
180 ppt
->x
, ppt
->y
, 0, This
->hwndWindow
, NULL
);
185 DoPageAction(This
, WB_GOBACK
);
188 DoPageAction(This
, WB_GOFORWARD
);
191 IWebBrowser2_ExecWB(This
->web_browser
, OLECMDID_SELECTALL
, 0, NULL
, NULL
);
193 case MIID_VIEWSOURCE
:
194 FIXME("View source\n");
197 DoPageAction(This
, WB_PRINT
);
200 DoPageAction(This
, WB_REFRESH
);
202 case MIID_PROPERTIES
:
203 FIXME("Properties\n");
206 IWebBrowser2_ExecWB(This
->web_browser
, OLECMDID_COPY
, 0, NULL
, NULL
);
209 IWebBrowser2_ExecWB(This
->web_browser
, OLECMDID_PASTE
, 0, NULL
, NULL
);
212 IWebBrowser2_ExecWB(This
->web_browser
, OLECMDID_CUT
, 0, NULL
, NULL
);
219 static HRESULT STDMETHODCALLTYPE
UI_GetHostInfo(IDocHostUIHandler
*iface
, DOCHOSTUIINFO
*pInfo
)
221 pInfo
->cbSize
= sizeof(DOCHOSTUIINFO
);
222 pInfo
->dwFlags
= DOCHOSTUIFLAG_NO3DBORDER
;
223 pInfo
->dwDoubleClick
= DOCHOSTUIDBLCLK_DEFAULT
;
228 static HRESULT STDMETHODCALLTYPE
UI_ShowUI(IDocHostUIHandler
*iface
, DWORD dwID
, IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
, IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
233 static HRESULT STDMETHODCALLTYPE
UI_HideUI(IDocHostUIHandler
*iface
)
238 static HRESULT STDMETHODCALLTYPE
UI_UpdateUI(IDocHostUIHandler
*iface
)
243 static HRESULT STDMETHODCALLTYPE
UI_EnableModeless(IDocHostUIHandler
*iface
, BOOL fEnable
)
248 static HRESULT STDMETHODCALLTYPE
UI_OnDocWindowActivate(IDocHostUIHandler
*iface
, BOOL fActivate
)
253 static HRESULT STDMETHODCALLTYPE
UI_OnFrameWindowActivate(IDocHostUIHandler
*iface
, BOOL fActivate
)
258 static HRESULT STDMETHODCALLTYPE
UI_ResizeBorder(IDocHostUIHandler
*iface
, LPCRECT prcBorder
, IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
263 static HRESULT STDMETHODCALLTYPE
UI_TranslateAccelerator(IDocHostUIHandler
*iface
, LPMSG lpMsg
, const GUID
*pguidCmdGroup
, DWORD nCmdID
)
268 static HRESULT STDMETHODCALLTYPE
UI_GetOptionKeyPath(IDocHostUIHandler
*iface
, LPOLESTR
*pchKey
, DWORD dw
)
273 static HRESULT STDMETHODCALLTYPE
UI_GetDropTarget(IDocHostUIHandler
*iface
, IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
278 static HRESULT STDMETHODCALLTYPE
UI_GetExternal(IDocHostUIHandler
*iface
, IDispatch
**ppDispatch
)
284 static HRESULT STDMETHODCALLTYPE
UI_TranslateUrl(IDocHostUIHandler
*iface
, DWORD dwTranslate
, OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
290 static HRESULT STDMETHODCALLTYPE
UI_FilterDataObject(IDocHostUIHandler
*iface
, IDataObject
*pDO
, IDataObject
**ppDORet
)
296 static const IDocHostUIHandlerVtbl DocHostUIHandlerVtbl
=
307 UI_OnDocWindowActivate
,
308 UI_OnFrameWindowActivate
,
310 UI_TranslateAccelerator
,
318 static inline WebBrowserContainer
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
320 return CONTAINING_RECORD(iface
, WebBrowserContainer
, IOleInPlaceSite_iface
);
323 static HRESULT STDMETHODCALLTYPE
InPlace_QueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, LPVOID
*ppvObj
)
325 WebBrowserContainer
*This
= impl_from_IOleInPlaceSite(iface
);
327 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
330 static ULONG STDMETHODCALLTYPE
InPlace_AddRef(IOleInPlaceSite
*iface
)
332 WebBrowserContainer
*This
= impl_from_IOleInPlaceSite(iface
);
334 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
337 static ULONG STDMETHODCALLTYPE
InPlace_Release(IOleInPlaceSite
*iface
)
339 WebBrowserContainer
*This
= impl_from_IOleInPlaceSite(iface
);
341 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
344 static HRESULT STDMETHODCALLTYPE
InPlace_GetWindow(IOleInPlaceSite
*iface
, HWND
*lphwnd
)
346 WebBrowserContainer
*This
= impl_from_IOleInPlaceSite(iface
);
348 *lphwnd
= This
->hwndWindow
;
352 static HRESULT STDMETHODCALLTYPE
InPlace_ContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
357 static HRESULT STDMETHODCALLTYPE
InPlace_CanInPlaceActivate(IOleInPlaceSite
*iface
)
362 static HRESULT STDMETHODCALLTYPE
InPlace_OnInPlaceActivate(IOleInPlaceSite
*iface
)
367 static HRESULT STDMETHODCALLTYPE
InPlace_OnUIActivate(IOleInPlaceSite
*iface
)
372 static HRESULT STDMETHODCALLTYPE
InPlace_GetWindowContext(IOleInPlaceSite
*iface
, LPOLEINPLACEFRAME
*lplpFrame
, LPOLEINPLACEUIWINDOW
*lplpDoc
, LPRECT lprcPosRect
, LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
374 WebBrowserContainer
*This
= impl_from_IOleInPlaceSite(iface
);
376 *lplpFrame
= &This
->IOleInPlaceFrame_iface
;
377 IOleInPlaceFrame_AddRef(&This
->IOleInPlaceFrame_iface
);
381 lpFrameInfo
->fMDIApp
= FALSE
;
382 lpFrameInfo
->hwndFrame
= This
->hwndWindow
;
383 lpFrameInfo
->haccel
= NULL
;
384 lpFrameInfo
->cAccelEntries
= 0;
389 static HRESULT STDMETHODCALLTYPE
InPlace_Scroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
394 static HRESULT STDMETHODCALLTYPE
InPlace_OnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
399 static HRESULT STDMETHODCALLTYPE
InPlace_OnInPlaceDeactivate(IOleInPlaceSite
*iface
)
404 static HRESULT STDMETHODCALLTYPE
InPlace_DiscardUndoState(IOleInPlaceSite
*iface
)
409 static HRESULT STDMETHODCALLTYPE
InPlace_DeactivateAndUndo(IOleInPlaceSite
*iface
)
414 static HRESULT STDMETHODCALLTYPE
InPlace_OnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
416 WebBrowserContainer
*This
= impl_from_IOleInPlaceSite(iface
);
417 IOleInPlaceObject
*inplace
;
419 if (IOleObject_QueryInterface(This
->ole_obj
, &IID_IOleInPlaceObject
,
420 (void **)&inplace
) == S_OK
)
422 IOleInPlaceObject_SetObjectRects(inplace
, lprcPosRect
, lprcPosRect
);
423 IOleInPlaceObject_Release(inplace
);
429 static const IOleInPlaceSiteVtbl OleInPlaceSiteVtbl
=
431 InPlace_QueryInterface
,
435 InPlace_ContextSensitiveHelp
,
436 InPlace_CanInPlaceActivate
,
437 InPlace_OnInPlaceActivate
,
438 InPlace_OnUIActivate
,
439 InPlace_GetWindowContext
,
441 InPlace_OnUIDeactivate
,
442 InPlace_OnInPlaceDeactivate
,
443 InPlace_DiscardUndoState
,
444 InPlace_DeactivateAndUndo
,
445 InPlace_OnPosRectChange
448 static inline WebBrowserContainer
*impl_from_IOleInPlaceFrame(IOleInPlaceFrame
*iface
)
450 return CONTAINING_RECORD(iface
, WebBrowserContainer
, IOleInPlaceFrame_iface
);
453 static HRESULT STDMETHODCALLTYPE
Frame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, LPVOID
*ppvObj
)
455 WebBrowserContainer
*This
= impl_from_IOleInPlaceFrame(iface
);
457 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
460 static ULONG STDMETHODCALLTYPE
Frame_AddRef(IOleInPlaceFrame
*iface
)
462 WebBrowserContainer
*This
= impl_from_IOleInPlaceFrame(iface
);
464 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
467 static ULONG STDMETHODCALLTYPE
Frame_Release(IOleInPlaceFrame
*iface
)
469 WebBrowserContainer
*This
= impl_from_IOleInPlaceFrame(iface
);
471 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
474 static HRESULT STDMETHODCALLTYPE
Frame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*lphwnd
)
476 WebBrowserContainer
*This
= impl_from_IOleInPlaceFrame(iface
);
478 *lphwnd
= This
->hwndWindow
;
482 static HRESULT STDMETHODCALLTYPE
Frame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
487 static HRESULT STDMETHODCALLTYPE
Frame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
492 static HRESULT STDMETHODCALLTYPE
Frame_RequestBorderSpace(IOleInPlaceFrame
*iface
, LPCBORDERWIDTHS pborderwidths
)
497 static HRESULT STDMETHODCALLTYPE
Frame_SetBorderSpace(IOleInPlaceFrame
*iface
, LPCBORDERWIDTHS pborderwidths
)
502 static HRESULT STDMETHODCALLTYPE
Frame_SetActiveObject(IOleInPlaceFrame
*iface
, IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
507 static HRESULT STDMETHODCALLTYPE
Frame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
, LPOLEMENUGROUPWIDTHS lpMenuWidths
)
512 static HRESULT STDMETHODCALLTYPE
Frame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
, HOLEMENU holemenu
, HWND hwndActiveObject
)
517 static HRESULT STDMETHODCALLTYPE
Frame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
522 static HRESULT STDMETHODCALLTYPE
Frame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
527 static HRESULT STDMETHODCALLTYPE
Frame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
532 static HRESULT STDMETHODCALLTYPE
Frame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
537 static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl
=
539 Frame_QueryInterface
,
543 Frame_ContextSensitiveHelp
,
545 Frame_RequestBorderSpace
,
546 Frame_SetBorderSpace
,
547 Frame_SetActiveObject
,
552 Frame_EnableModeless
,
553 Frame_TranslateAccelerator
556 static HRESULT STDMETHODCALLTYPE
Storage_QueryInterface(IStorage
*This
, REFIID riid
, LPVOID
*ppvObj
)
561 static ULONG STDMETHODCALLTYPE
Storage_AddRef(IStorage
*This
)
566 static ULONG STDMETHODCALLTYPE
Storage_Release(IStorage
*This
)
571 static HRESULT STDMETHODCALLTYPE
Storage_CreateStream(IStorage
*This
, const WCHAR
*pwcsName
, DWORD grfMode
, DWORD reserved1
, DWORD reserved2
, IStream
**ppstm
)
576 static HRESULT STDMETHODCALLTYPE
Storage_OpenStream(IStorage
*This
, const WCHAR
* pwcsName
, void *reserved1
, DWORD grfMode
, DWORD reserved2
, IStream
**ppstm
)
581 static HRESULT STDMETHODCALLTYPE
Storage_CreateStorage(IStorage
*This
, const WCHAR
*pwcsName
, DWORD grfMode
, DWORD reserved1
, DWORD reserved2
, IStorage
**ppstg
)
586 static HRESULT STDMETHODCALLTYPE
Storage_OpenStorage(IStorage
*This
, const WCHAR
* pwcsName
, IStorage
* pstgPriority
, DWORD grfMode
, SNB snbExclude
, DWORD reserved
, IStorage
**ppstg
)
591 static HRESULT STDMETHODCALLTYPE
Storage_CopyTo(IStorage
*This
, DWORD ciidExclude
, IID
const *rgiidExclude
, SNB snbExclude
,IStorage
*pstgDest
)
596 static HRESULT STDMETHODCALLTYPE
Storage_MoveElementTo(IStorage
*This
, const OLECHAR
*pwcsName
,IStorage
* pstgDest
, const OLECHAR
*pwcsNewName
, DWORD grfFlags
)
601 static HRESULT STDMETHODCALLTYPE
Storage_Commit(IStorage
*This
, DWORD grfCommitFlags
)
606 static HRESULT STDMETHODCALLTYPE
Storage_Revert(IStorage
*This
)
611 static HRESULT STDMETHODCALLTYPE
Storage_EnumElements(IStorage
*This
, DWORD reserved1
, void *reserved2
, DWORD reserved3
, IEnumSTATSTG
**ppenum
)
616 static HRESULT STDMETHODCALLTYPE
Storage_DestroyElement(IStorage
*This
, const OLECHAR
*pwcsName
)
621 static HRESULT STDMETHODCALLTYPE
Storage_RenameElement(IStorage
*This
, const WCHAR
*pwcsOldName
, const WCHAR
*pwcsNewName
)
626 static HRESULT STDMETHODCALLTYPE
Storage_SetElementTimes(IStorage
*This
, const WCHAR
*pwcsName
, FILETIME
const *pctime
, FILETIME
const *patime
, FILETIME
const *pmtime
)
631 static HRESULT STDMETHODCALLTYPE
Storage_SetClass(IStorage
*This
, REFCLSID clsid
)
636 static HRESULT STDMETHODCALLTYPE
Storage_SetStateBits(IStorage
*This
, DWORD grfStateBits
, DWORD grfMask
)
641 static HRESULT STDMETHODCALLTYPE
Storage_Stat(IStorage
*This
, STATSTG
*pstatstg
, DWORD grfStatFlag
)
646 static const IStorageVtbl MyIStorageTable
=
648 Storage_QueryInterface
,
651 Storage_CreateStream
,
653 Storage_CreateStorage
,
656 Storage_MoveElementTo
,
659 Storage_EnumElements
,
660 Storage_DestroyElement
,
661 Storage_RenameElement
,
662 Storage_SetElementTimes
,
664 Storage_SetStateBits
,
668 static IStorage MyIStorage
= { &MyIStorageTable
};
670 BOOL
InitWebBrowser(HHInfo
*info
, HWND hwndParent
)
672 WebBrowserContainer
*container
;
673 IOleInPlaceObject
*inplace
;
677 container
= heap_alloc_zero(sizeof(*container
));
681 container
->IOleClientSite_iface
.lpVtbl
= &OleClientSiteVtbl
;
682 container
->IOleInPlaceSite_iface
.lpVtbl
= &OleInPlaceSiteVtbl
;
683 container
->IOleInPlaceFrame_iface
.lpVtbl
= &OleInPlaceFrameVtbl
;
684 container
->IDocHostUIHandler_iface
.lpVtbl
= &DocHostUIHandlerVtbl
;
686 container
->hwndWindow
= hwndParent
;
688 info
->web_browser
= container
;
690 hr
= OleCreate(&CLSID_WebBrowser
, &IID_IOleObject
, OLERENDER_DRAW
, 0,
691 &container
->IOleClientSite_iface
, &MyIStorage
,
692 (void **)&container
->ole_obj
);
694 if (FAILED(hr
)) goto error
;
696 GetClientRect(hwndParent
, &rc
);
698 hr
= OleSetContainedObject((struct IUnknown
*)container
->ole_obj
, TRUE
);
699 if (FAILED(hr
)) goto error
;
701 hr
= IOleObject_DoVerb(container
->ole_obj
, OLEIVERB_SHOW
, NULL
,
702 &container
->IOleClientSite_iface
, -1, hwndParent
, &rc
);
703 if (FAILED(hr
)) goto error
;
705 hr
= IOleObject_QueryInterface(container
->ole_obj
, &IID_IOleInPlaceObject
, (void**)&inplace
);
706 if (FAILED(hr
)) goto error
;
708 IOleInPlaceObject_SetObjectRects(inplace
, &rc
, &rc
);
709 IOleInPlaceObject_Release(inplace
);
711 hr
= IOleObject_QueryInterface(container
->ole_obj
, &IID_IWebBrowser2
, (void **)&container
->web_browser
);
716 ReleaseWebBrowser(info
);
720 void ReleaseWebBrowser(HHInfo
*info
)
722 WebBrowserContainer
*container
= info
->web_browser
;
728 if(container
->ole_obj
) {
729 IOleInPlaceSite
*inplace
;
731 hres
= IOleObject_QueryInterface(container
->ole_obj
, &IID_IOleInPlaceSite
, (void**)&inplace
);
732 if(SUCCEEDED(hres
)) {
733 IOleInPlaceSite_OnInPlaceDeactivate(inplace
);
734 IOleInPlaceSite_Release(inplace
);
737 IOleObject_SetClientSite(container
->ole_obj
, NULL
);
740 info
->web_browser
= NULL
;
741 IOleClientSite_Release(&container
->IOleClientSite_iface
);
744 void ResizeWebBrowser(HHInfo
*info
, DWORD dwWidth
, DWORD dwHeight
)
746 if (!info
->web_browser
)
749 IWebBrowser2_put_Width(info
->web_browser
->web_browser
, dwWidth
);
750 IWebBrowser2_put_Height(info
->web_browser
->web_browser
, dwHeight
);
753 void DoPageAction(WebBrowserContainer
*container
, DWORD dwAction
)
755 if (!container
|| !container
->web_browser
)
761 IWebBrowser2_GoBack(container
->web_browser
);
764 IWebBrowser2_GoForward(container
->web_browser
);
767 IWebBrowser2_GoHome(container
->web_browser
);
770 IWebBrowser2_GoSearch(container
->web_browser
);
773 IWebBrowser2_Refresh(container
->web_browser
);
776 IWebBrowser2_Stop(container
->web_browser
);
779 IWebBrowser2_ExecWB(container
->web_browser
, OLECMDID_PRINT
, OLECMDEXECOPT_DONTPROMPTUSER
, 0, 0);