oleacc: Add WindowFromAccessibleObject implementation.

This commit is contained in:
Piotr Caban 2014-05-15 17:53:43 +02:00 committed by Alexandre Julliard
parent 25312a10d3
commit 6bd87c6bdb
3 changed files with 38 additions and 1 deletions

View File

@ -295,6 +295,40 @@ HRESULT WINAPI AccessibleObjectFromWindow( HWND hwnd, DWORD dwObjectID,
return CreateStdAccessibleObject(hwnd, dwObjectID, riid, ppvObject);
}
HRESULT WINAPI WindowFromAccessibleObject(IAccessible *acc, HWND *phwnd)
{
IDispatch *parent;
IOleWindow *ow;
HRESULT hres;
TRACE("%p %p\n", acc, phwnd);
IAccessible_AddRef(acc);
while(1) {
hres = IAccessible_QueryInterface(acc, &IID_IOleWindow, (void**)&ow);
if(SUCCEEDED(hres)) {
hres = IOleWindow_GetWindow(ow, phwnd);
IOleWindow_Release(ow);
IAccessible_Release(acc);
return hres;
}
hres = IAccessible_get_accParent(acc, &parent);
IAccessible_Release(acc);
if(FAILED(hres))
return hres;
if(hres!=S_OK || !parent) {
*phwnd = NULL;
return hres;
}
hres = IDispatch_QueryInterface(parent, &IID_IAccessible, (void**)&acc);
IDispatch_Release(parent);
if(FAILED(hres))
return hres;
}
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpvReserved)
{

View File

@ -19,4 +19,4 @@
@ stub LIBID_Accessibility
@ stdcall LresultFromObject(ptr long ptr)
@ stdcall ObjectFromLresult(long ptr long ptr)
@ stub WindowFromAccessibleObject
@ stdcall WindowFromAccessibleObject(ptr ptr)

View File

@ -410,6 +410,9 @@ static void test_default_client_accessible_object(void)
hr = IOleWindow_GetWindow(ow, &hwnd2);
ok(hr == S_OK, "got %x\n", hr);
ok(hwnd == hwnd2, "hwnd2 = %p, expected %p\n", hwnd2, hwnd);
hr = WindowFromAccessibleObject(acc, &hwnd2);
ok(hr == S_OK, "got %x\n", hr);
ok(hwnd == hwnd2, "hwnd2 = %p, expected %p\n", hwnd2, hwnd);
IOleWindow_Release(ow);
hr = IAccessible_get_accChildCount(acc, &l);