From: Piotr Caban <piotr@codeweavers.com>
Subject: [PATCH 1/2] ieframe: Added OleObject_Close implementation
Message-Id: <4E367FD2.5040504@codeweavers.com>
Date: Mon, 01 Aug 2011 12:28:34 +0200

---
  dlls/ieframe/oleobject.c |   23 +++++++++++++++++++++--
  1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/ieframe/oleobject.c b/dlls/ieframe/oleobject.c
index d227bcc..3906f85 100644
--- a/dlls/ieframe/oleobject.c
+++ b/dlls/ieframe/oleobject.c
@@ -135,6 +135,7 @@ static HRESULT activate_inplace(WebBrowser *This, IOleClientSite *active_site)
     if(hres != S_OK) {
         WARN("CanInPlaceActivate returned: %08x\n", hres);
         IOleInPlaceSite_Release(This->inplace);
+        This->inplace = NULL;
         return E_FAIL;
     }
 
@@ -402,8 +403,26 @@ static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szCont
 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
 {
     WebBrowser *This = impl_from_IOleObject(iface);
-    FIXME("(%p)->(%d)\n", This, dwSaveOption);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%d)\n", This, dwSaveOption);
+
+    if(dwSaveOption != OLECLOSE_NOSAVE) {
+        FIXME("unimplemnted flag: %x\n", dwSaveOption);
+        return E_NOTIMPL;
+    }
+
+    if(This->doc_host.frame)
+        IOleInPlaceFrame_SetActiveObject(This->doc_host.frame, NULL, NULL);
+
+    if(This->uiwindow)
+        IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, NULL, NULL);
+
+    if(This->inplace) {
+        IOleInPlaceSite_OnUIDeactivate(This->inplace, FALSE);
+        IOleInPlaceSite_OnInPlaceDeactivate(This->inplace);
+    }
+
+    return IOleObject_SetClientSite(iface, NULL);
 }
 
 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)