Jactry Zeng : riched20: Implement IOleWindow::GetWindow.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 16 10:34:24 CDT 2015


Module: wine
Branch: master
Commit: f1d22c0ebdab26fee8b29dd9bc861b81d894186b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f1d22c0ebdab26fee8b29dd9bc861b81d894186b

Author: Jactry Zeng <jzeng at codeweavers.com>
Date:   Mon Mar 16 17:27:38 2015 +0800

riched20: Implement IOleWindow::GetWindow.

---

 dlls/riched20/richole.c       |  9 +++++++--
 dlls/riched20/tests/richole.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 47f2964..c62998a 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -363,8 +363,13 @@ static HRESULT WINAPI IOleWindow_fnContextSensitiveHelp(IOleWindow *iface, BOOL
 static HRESULT WINAPI IOleWindow_fnGetWindow(IOleWindow *iface, HWND *phwnd)
 {
     IOleClientSiteImpl *This = impl_from_IOleWindow(iface);
-    FIXME("not implemented: (%p)->(%p)\n", This, phwnd);
-    return E_NOTIMPL;
+    TRACE("(%p)->(%p)\n", This, phwnd);
+
+    if (!phwnd)
+        return E_INVALIDARG;
+
+    *phwnd = This->reOle->editor->hWnd;
+    return S_OK;
 }
 
 static const IOleWindowVtbl olewinvt = {
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 22d2048..a89ee55 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -1000,6 +1000,34 @@ static void test_IOleClientSite_QueryInterface(void)
   release_interfaces(&w, &reOle, &txtDoc, NULL);
 }
 
+static void test_IOleWindow_GetWindow(void)
+{
+  HWND w;
+  IRichEditOle *reOle = NULL;
+  ITextDocument *txtDoc = NULL;
+  IOleClientSite *clientSite = NULL;
+  IOleWindow *oleWin = NULL;
+  HRESULT hres;
+  HWND hwnd;
+
+  create_interfaces(&w, &reOle, &txtDoc, NULL);
+  hres = IRichEditOle_GetClientSite(reOle, &clientSite);
+  ok(hres == S_OK, "IRichEditOle_QueryInterface: 0x%08x\n", hres);
+
+  hres = IOleClientSite_QueryInterface(clientSite, &IID_IOleWindow, (void **)&oleWin);
+  ok(hres == S_OK, "IOleClientSite_QueryInterface: 0x%08x\n", hres);
+  hres = IOleWindow_GetWindow(oleWin, &hwnd);
+  ok(hres == S_OK, "IOleClientSite_GetWindow: 0x%08x\n", hres);
+  ok(w == hwnd, "got wrong pointer\n");
+
+  hres = IOleWindow_GetWindow(oleWin, NULL);
+  ok(hres == E_INVALIDARG, "IOleClientSite_GetWindow: 0x%08x\n", hres);
+
+  IOleWindow_Release(oleWin);
+  IOleClientSite_Release(clientSite);
+  release_interfaces(&w, &reOle, &txtDoc, NULL);
+}
+
 START_TEST(richole)
 {
   /* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -1019,4 +1047,5 @@ START_TEST(richole)
   test_ITextRange_GetDuplicate();
   test_ITextRange_Collapse();
   test_IOleClientSite_QueryInterface();
+  test_IOleWindow_GetWindow();
 }




More information about the wine-cvs mailing list