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
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp
);
27 typedef struct IOleClientSiteImpl
29 IOleClientSite IOleClientSite_iface
;
30 IOleInPlaceSite IOleInPlaceSite_iface
;
31 IOleInPlaceFrame IOleInPlaceFrame_iface
;
32 IDocHostUIHandler IDocHostUIHandler_iface
;
34 /* IOleClientSiteImpl data */
35 IOleObject
*pBrowserObject
;
38 /* IOleInPlaceFrame data */
42 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
44 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
47 static HRESULT STDMETHODCALLTYPE
Site_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppvObj
)
49 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
53 if (IsEqualIID(riid
, &IID_IUnknown
)) {
54 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppvObj
);
55 *ppvObj
= &This
->IOleClientSite_iface
;
56 }else if(IsEqualIID(riid
, &IID_IOleClientSite
)) {
57 TRACE("(%p)->(IID_IOleClientSite %p)\n", This
, ppvObj
);
58 *ppvObj
= &This
->IOleClientSite_iface
;
59 }else if (IsEqualIID(riid
, &IID_IOleInPlaceSite
)) {
60 TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This
, ppvObj
);
61 *ppvObj
= &This
->IOleInPlaceSite_iface
;
62 }else if (IsEqualIID(riid
, &IID_IOleInPlaceFrame
)) {
63 TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This
, ppvObj
);
64 *ppvObj
= &This
->IOleInPlaceSite_iface
;
65 }else if (IsEqualIID(riid
, &IID_IDocHostUIHandler
)) {
66 TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This
, ppvObj
);
67 *ppvObj
= &This
->IDocHostUIHandler_iface
;
69 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObj
);
73 IUnknown_AddRef((IUnknown
*)*ppvObj
);
77 static ULONG STDMETHODCALLTYPE
Site_AddRef(IOleClientSite
*iface
)
79 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
80 LONG ref
= InterlockedIncrement(&This
->ref
);
82 TRACE("(%p) ref=%d\n", This
, ref
);
87 static ULONG STDMETHODCALLTYPE
Site_Release(IOleClientSite
*iface
)
89 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
90 LONG ref
= InterlockedDecrement(&This
->ref
);
92 TRACE("(%p) ref=%d\n", This
, ref
);
100 static HRESULT STDMETHODCALLTYPE
Site_SaveObject(IOleClientSite
*iface
)
105 static HRESULT STDMETHODCALLTYPE
Site_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
110 static HRESULT STDMETHODCALLTYPE
Site_GetContainer(IOleClientSite
*iface
, LPOLECONTAINER
*ppContainer
)
114 return E_NOINTERFACE
;
117 static HRESULT STDMETHODCALLTYPE
Site_ShowObject(IOleClientSite
*iface
)
122 static HRESULT STDMETHODCALLTYPE
Site_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
127 static HRESULT STDMETHODCALLTYPE
Site_RequestNewObjectLayout(IOleClientSite
*iface
)
132 static const IOleClientSiteVtbl MyIOleClientSiteTable
=
142 Site_RequestNewObjectLayout
145 static inline IOleClientSiteImpl
*impl_from_IDocHostUIHandler(IDocHostUIHandler
*iface
)
147 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IDocHostUIHandler_iface
);
150 static HRESULT STDMETHODCALLTYPE
UI_QueryInterface(IDocHostUIHandler
*iface
, REFIID riid
, LPVOID
*ppvObj
)
152 IOleClientSiteImpl
*This
= impl_from_IDocHostUIHandler(iface
);
154 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
157 static ULONG STDMETHODCALLTYPE
UI_AddRef(IDocHostUIHandler
*iface
)
159 IOleClientSiteImpl
*This
= impl_from_IDocHostUIHandler(iface
);
161 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
164 static ULONG STDMETHODCALLTYPE
UI_Release(IDocHostUIHandler
* iface
)
166 IOleClientSiteImpl
*This
= impl_from_IDocHostUIHandler(iface
);
168 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
171 static HRESULT STDMETHODCALLTYPE
UI_ShowContextMenu(IDocHostUIHandler
*iface
, DWORD dwID
, POINT
*ppt
, IUnknown
*pcmdtReserved
, IDispatch
*pdispReserved
)
176 static HRESULT STDMETHODCALLTYPE
UI_GetHostInfo(IDocHostUIHandler
*iface
, DOCHOSTUIINFO
*pInfo
)
178 pInfo
->cbSize
= sizeof(DOCHOSTUIINFO
);
179 pInfo
->dwFlags
= DOCHOSTUIFLAG_NO3DBORDER
;
180 pInfo
->dwDoubleClick
= DOCHOSTUIDBLCLK_DEFAULT
;
185 static HRESULT STDMETHODCALLTYPE
UI_ShowUI(IDocHostUIHandler
*iface
, DWORD dwID
, IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
, IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
190 static HRESULT STDMETHODCALLTYPE
UI_HideUI(IDocHostUIHandler
*iface
)
195 static HRESULT STDMETHODCALLTYPE
UI_UpdateUI(IDocHostUIHandler
*iface
)
200 static HRESULT STDMETHODCALLTYPE
UI_EnableModeless(IDocHostUIHandler
*iface
, BOOL fEnable
)
205 static HRESULT STDMETHODCALLTYPE
UI_OnDocWindowActivate(IDocHostUIHandler
*iface
, BOOL fActivate
)
210 static HRESULT STDMETHODCALLTYPE
UI_OnFrameWindowActivate(IDocHostUIHandler
*iface
, BOOL fActivate
)
215 static HRESULT STDMETHODCALLTYPE
UI_ResizeBorder(IDocHostUIHandler
*iface
, LPCRECT prcBorder
, IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
220 static HRESULT STDMETHODCALLTYPE
UI_TranslateAccelerator(IDocHostUIHandler
*iface
, LPMSG lpMsg
, const GUID
*pguidCmdGroup
, DWORD nCmdID
)
225 static HRESULT STDMETHODCALLTYPE
UI_GetOptionKeyPath(IDocHostUIHandler
*iface
, LPOLESTR
*pchKey
, DWORD dw
)
230 static HRESULT STDMETHODCALLTYPE
UI_GetDropTarget(IDocHostUIHandler
*iface
, IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
235 static HRESULT STDMETHODCALLTYPE
UI_GetExternal(IDocHostUIHandler
*iface
, IDispatch
**ppDispatch
)
241 static HRESULT STDMETHODCALLTYPE
UI_TranslateUrl(IDocHostUIHandler
*iface
, DWORD dwTranslate
, OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
247 static HRESULT STDMETHODCALLTYPE
UI_FilterDataObject(IDocHostUIHandler
*iface
, IDataObject
*pDO
, IDataObject
**ppDORet
)
253 static const IDocHostUIHandlerVtbl MyIDocHostUIHandlerTable
=
264 UI_OnDocWindowActivate
,
265 UI_OnFrameWindowActivate
,
267 UI_TranslateAccelerator
,
275 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
277 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceSite_iface
);
280 static HRESULT STDMETHODCALLTYPE
InPlace_QueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, LPVOID
*ppvObj
)
282 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
284 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
287 static ULONG STDMETHODCALLTYPE
InPlace_AddRef(IOleInPlaceSite
*iface
)
289 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
291 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
294 static ULONG STDMETHODCALLTYPE
InPlace_Release(IOleInPlaceSite
*iface
)
296 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
298 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
301 static HRESULT STDMETHODCALLTYPE
InPlace_GetWindow(IOleInPlaceSite
*iface
, HWND
*lphwnd
)
303 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
304 *lphwnd
= This
->hwndWindow
;
309 static HRESULT STDMETHODCALLTYPE
InPlace_ContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
314 static HRESULT STDMETHODCALLTYPE
InPlace_CanInPlaceActivate(IOleInPlaceSite
*iface
)
319 static HRESULT STDMETHODCALLTYPE
InPlace_OnInPlaceActivate(IOleInPlaceSite
*iface
)
324 static HRESULT STDMETHODCALLTYPE
InPlace_OnUIActivate(IOleInPlaceSite
*iface
)
329 static HRESULT STDMETHODCALLTYPE
InPlace_GetWindowContext(IOleInPlaceSite
*iface
, LPOLEINPLACEFRAME
*lplpFrame
, LPOLEINPLACEUIWINDOW
*lplpDoc
, LPRECT lprcPosRect
, LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
331 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
333 *lplpFrame
= &This
->IOleInPlaceFrame_iface
;
334 IOleInPlaceFrame_AddRef(&This
->IOleInPlaceFrame_iface
);
338 lpFrameInfo
->fMDIApp
= FALSE
;
339 lpFrameInfo
->hwndFrame
= This
->hwndWindow
;
340 lpFrameInfo
->haccel
= NULL
;
341 lpFrameInfo
->cAccelEntries
= 0;
346 static HRESULT STDMETHODCALLTYPE
InPlace_Scroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
351 static HRESULT STDMETHODCALLTYPE
InPlace_OnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
356 static HRESULT STDMETHODCALLTYPE
InPlace_OnInPlaceDeactivate(IOleInPlaceSite
*iface
)
361 static HRESULT STDMETHODCALLTYPE
InPlace_DiscardUndoState(IOleInPlaceSite
*iface
)
366 static HRESULT STDMETHODCALLTYPE
InPlace_DeactivateAndUndo(IOleInPlaceSite
*iface
)
371 static HRESULT STDMETHODCALLTYPE
InPlace_OnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
373 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
374 IOleInPlaceObject
*inplace
;
376 if (IOleObject_QueryInterface(This
->pBrowserObject
, &IID_IOleInPlaceObject
,
377 (void **)&inplace
) == S_OK
)
379 IOleInPlaceObject_SetObjectRects(inplace
, lprcPosRect
, lprcPosRect
);
380 IOleInPlaceObject_Release(inplace
);
386 static const IOleInPlaceSiteVtbl MyIOleInPlaceSiteTable
=
388 InPlace_QueryInterface
,
392 InPlace_ContextSensitiveHelp
,
393 InPlace_CanInPlaceActivate
,
394 InPlace_OnInPlaceActivate
,
395 InPlace_OnUIActivate
,
396 InPlace_GetWindowContext
,
398 InPlace_OnUIDeactivate
,
399 InPlace_OnInPlaceDeactivate
,
400 InPlace_DiscardUndoState
,
401 InPlace_DeactivateAndUndo
,
402 InPlace_OnPosRectChange
405 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceFrame(IOleInPlaceFrame
*iface
)
407 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceFrame_iface
);
410 static HRESULT STDMETHODCALLTYPE
Frame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, LPVOID
*ppvObj
)
412 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceFrame(iface
);
414 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
417 static ULONG STDMETHODCALLTYPE
Frame_AddRef(IOleInPlaceFrame
*iface
)
419 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceFrame(iface
);
421 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
424 static ULONG STDMETHODCALLTYPE
Frame_Release(IOleInPlaceFrame
*iface
)
426 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceFrame(iface
);
428 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
431 static HRESULT STDMETHODCALLTYPE
Frame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*lphwnd
)
433 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceFrame(iface
);
434 *lphwnd
= This
->hwndWindow
;
439 static HRESULT STDMETHODCALLTYPE
Frame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
444 static HRESULT STDMETHODCALLTYPE
Frame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
449 static HRESULT STDMETHODCALLTYPE
Frame_RequestBorderSpace(IOleInPlaceFrame
*iface
, LPCBORDERWIDTHS pborderwidths
)
454 static HRESULT STDMETHODCALLTYPE
Frame_SetBorderSpace(IOleInPlaceFrame
*iface
, LPCBORDERWIDTHS pborderwidths
)
459 static HRESULT STDMETHODCALLTYPE
Frame_SetActiveObject(IOleInPlaceFrame
*iface
, IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
464 static HRESULT STDMETHODCALLTYPE
Frame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
, LPOLEMENUGROUPWIDTHS lpMenuWidths
)
469 static HRESULT STDMETHODCALLTYPE
Frame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
, HOLEMENU holemenu
, HWND hwndActiveObject
)
474 static HRESULT STDMETHODCALLTYPE
Frame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
479 static HRESULT STDMETHODCALLTYPE
Frame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
484 static HRESULT STDMETHODCALLTYPE
Frame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
489 static HRESULT STDMETHODCALLTYPE
Frame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
494 static const IOleInPlaceFrameVtbl MyIOleInPlaceFrameTable
=
496 Frame_QueryInterface
,
500 Frame_ContextSensitiveHelp
,
502 Frame_RequestBorderSpace
,
503 Frame_SetBorderSpace
,
504 Frame_SetActiveObject
,
509 Frame_EnableModeless
,
510 Frame_TranslateAccelerator
513 static HRESULT STDMETHODCALLTYPE
Storage_QueryInterface(IStorage
*This
, REFIID riid
, LPVOID
*ppvObj
)
518 static ULONG STDMETHODCALLTYPE
Storage_AddRef(IStorage
*This
)
523 static ULONG STDMETHODCALLTYPE
Storage_Release(IStorage
*This
)
528 static HRESULT STDMETHODCALLTYPE
Storage_CreateStream(IStorage
*This
, const WCHAR
*pwcsName
, DWORD grfMode
, DWORD reserved1
, DWORD reserved2
, IStream
**ppstm
)
533 static HRESULT STDMETHODCALLTYPE
Storage_OpenStream(IStorage
*This
, const WCHAR
* pwcsName
, void *reserved1
, DWORD grfMode
, DWORD reserved2
, IStream
**ppstm
)
538 static HRESULT STDMETHODCALLTYPE
Storage_CreateStorage(IStorage
*This
, const WCHAR
*pwcsName
, DWORD grfMode
, DWORD reserved1
, DWORD reserved2
, IStorage
**ppstg
)
543 static HRESULT STDMETHODCALLTYPE
Storage_OpenStorage(IStorage
*This
, const WCHAR
* pwcsName
, IStorage
* pstgPriority
, DWORD grfMode
, SNB snbExclude
, DWORD reserved
, IStorage
**ppstg
)
548 static HRESULT STDMETHODCALLTYPE
Storage_CopyTo(IStorage
*This
, DWORD ciidExclude
, IID
const *rgiidExclude
, SNB snbExclude
,IStorage
*pstgDest
)
553 static HRESULT STDMETHODCALLTYPE
Storage_MoveElementTo(IStorage
*This
, const OLECHAR
*pwcsName
,IStorage
* pstgDest
, const OLECHAR
*pwcsNewName
, DWORD grfFlags
)
558 static HRESULT STDMETHODCALLTYPE
Storage_Commit(IStorage
*This
, DWORD grfCommitFlags
)
563 static HRESULT STDMETHODCALLTYPE
Storage_Revert(IStorage
*This
)
568 static HRESULT STDMETHODCALLTYPE
Storage_EnumElements(IStorage
*This
, DWORD reserved1
, void *reserved2
, DWORD reserved3
, IEnumSTATSTG
**ppenum
)
573 static HRESULT STDMETHODCALLTYPE
Storage_DestroyElement(IStorage
*This
, const OLECHAR
*pwcsName
)
578 static HRESULT STDMETHODCALLTYPE
Storage_RenameElement(IStorage
*This
, const WCHAR
*pwcsOldName
, const WCHAR
*pwcsNewName
)
583 static HRESULT STDMETHODCALLTYPE
Storage_SetElementTimes(IStorage
*This
, const WCHAR
*pwcsName
, FILETIME
const *pctime
, FILETIME
const *patime
, FILETIME
const *pmtime
)
588 static HRESULT STDMETHODCALLTYPE
Storage_SetClass(IStorage
*This
, REFCLSID clsid
)
593 static HRESULT STDMETHODCALLTYPE
Storage_SetStateBits(IStorage
*This
, DWORD grfStateBits
, DWORD grfMask
)
598 static HRESULT STDMETHODCALLTYPE
Storage_Stat(IStorage
*This
, STATSTG
*pstatstg
, DWORD grfStatFlag
)
603 static const IStorageVtbl MyIStorageTable
=
605 Storage_QueryInterface
,
608 Storage_CreateStream
,
610 Storage_CreateStorage
,
613 Storage_MoveElementTo
,
616 Storage_EnumElements
,
617 Storage_DestroyElement
,
618 Storage_RenameElement
,
619 Storage_SetElementTimes
,
621 Storage_SetStateBits
,
625 static IStorage MyIStorage
= { &MyIStorageTable
};
627 BOOL
InitWebBrowser(HHInfo
*info
, HWND hwndParent
)
629 IOleClientSiteImpl
*iOleClientSiteImpl
;
630 IOleInPlaceObject
*inplace
;
631 IOleObject
*browserObject
;
632 IWebBrowser2
*webBrowser2
;
636 iOleClientSiteImpl
= heap_alloc_zero(sizeof(IOleClientSiteImpl
));
637 if (!iOleClientSiteImpl
)
640 iOleClientSiteImpl
->ref
= 1;
641 iOleClientSiteImpl
->IOleClientSite_iface
.lpVtbl
= &MyIOleClientSiteTable
;
642 iOleClientSiteImpl
->IOleInPlaceSite_iface
.lpVtbl
= &MyIOleInPlaceSiteTable
;
643 iOleClientSiteImpl
->IOleInPlaceFrame_iface
.lpVtbl
= &MyIOleInPlaceFrameTable
;
644 iOleClientSiteImpl
->hwndWindow
= hwndParent
;
645 iOleClientSiteImpl
->IDocHostUIHandler_iface
.lpVtbl
= &MyIDocHostUIHandlerTable
;
647 hr
= OleCreate(&CLSID_WebBrowser
, &IID_IOleObject
, OLERENDER_DRAW
, 0,
648 &iOleClientSiteImpl
->IOleClientSite_iface
, &MyIStorage
,
649 (void **)&browserObject
);
651 info
->client_site
= &iOleClientSiteImpl
->IOleClientSite_iface
;
652 info
->wb_object
= browserObject
;
654 if (FAILED(hr
)) goto error
;
656 /* make the browser object accessible to the IOleClientSite implementation */
657 iOleClientSiteImpl
->pBrowserObject
= browserObject
;
659 GetClientRect(hwndParent
, &rc
);
661 hr
= OleSetContainedObject((struct IUnknown
*)browserObject
, TRUE
);
662 if (FAILED(hr
)) goto error
;
664 hr
= IOleObject_DoVerb(browserObject
, OLEIVERB_SHOW
, NULL
,
665 &iOleClientSiteImpl
->IOleClientSite_iface
,
666 -1, hwndParent
, &rc
);
667 if (FAILED(hr
)) goto error
;
669 hr
= IOleObject_QueryInterface(browserObject
, &IID_IOleInPlaceObject
, (void**)&inplace
);
670 if (FAILED(hr
)) goto error
;
672 IOleInPlaceObject_SetObjectRects(inplace
, &rc
, &rc
);
673 IOleInPlaceObject_Release(inplace
);
675 hr
= IOleObject_QueryInterface(browserObject
, &IID_IWebBrowser2
,
676 (void **)&webBrowser2
);
679 info
->web_browser
= webBrowser2
;
684 ReleaseWebBrowser(info
);
685 heap_free(iOleClientSiteImpl
);
690 void ReleaseWebBrowser(HHInfo
*info
)
694 if (info
->web_browser
)
696 IWebBrowser2_Release(info
->web_browser
);
697 info
->web_browser
= NULL
;
700 if (info
->client_site
)
702 IOleClientSite_Release(info
->client_site
);
703 info
->client_site
= NULL
;
706 if(info
->wb_object
) {
707 IOleInPlaceSite
*inplace
;
709 hres
= IOleObject_QueryInterface(info
->wb_object
, &IID_IOleInPlaceSite
, (void**)&inplace
);
710 if(SUCCEEDED(hres
)) {
711 IOleInPlaceSite_OnInPlaceDeactivate(inplace
);
712 IOleInPlaceSite_Release(inplace
);
715 IOleObject_SetClientSite(info
->wb_object
, NULL
);
717 IOleObject_Release(info
->wb_object
);
718 info
->wb_object
= NULL
;
722 void ResizeWebBrowser(HHInfo
*info
, DWORD dwWidth
, DWORD dwHeight
)
724 if (!info
->web_browser
)
727 IWebBrowser2_put_Width(info
->web_browser
, dwWidth
);
728 IWebBrowser2_put_Height(info
->web_browser
, dwHeight
);
731 void DoPageAction(HHInfo
*info
, DWORD dwAction
)
733 IWebBrowser2
*pWebBrowser2
= info
->web_browser
;
741 IWebBrowser2_GoBack(pWebBrowser2
);
744 IWebBrowser2_GoForward(pWebBrowser2
);
747 IWebBrowser2_GoHome(pWebBrowser2
);
750 IWebBrowser2_GoSearch(pWebBrowser2
);
753 IWebBrowser2_Refresh(pWebBrowser2
);
756 IWebBrowser2_Stop(pWebBrowser2
);
759 IWebBrowser2_ExecWB(pWebBrowser2
, OLECMDID_PRINT
, OLECMDEXECOPT_DONTPROMPTUSER
, 0, 0);