riched20: Implement IOleWindow::GetWindow.

This commit is contained in:
Jactry Zeng 2015-03-16 17:27:38 +08:00 committed by Alexandre Julliard
parent bbb9755896
commit f1d22c0ebd
2 changed files with 36 additions and 2 deletions

View File

@ -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 = {

View File

@ -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();
}