From f1d22c0ebdab26fee8b29dd9bc861b81d894186b Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Mon, 16 Mar 2015 17:27:38 +0800 Subject: [PATCH] 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 47f296443ed..c62998aac61 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 22d2048247b..a89ee556a9f 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(); }