oleacc: Add WindowFromAccessibleObject implementation.
This commit is contained in:
parent
25312a10d3
commit
6bd87c6bdb
|
@ -295,6 +295,40 @@ HRESULT WINAPI AccessibleObjectFromWindow( HWND hwnd, DWORD dwObjectID,
|
||||||
return CreateStdAccessibleObject(hwnd, dwObjectID, riid, ppvObject);
|
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,
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
|
||||||
LPVOID lpvReserved)
|
LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,4 +19,4 @@
|
||||||
@ stub LIBID_Accessibility
|
@ stub LIBID_Accessibility
|
||||||
@ stdcall LresultFromObject(ptr long ptr)
|
@ stdcall LresultFromObject(ptr long ptr)
|
||||||
@ stdcall ObjectFromLresult(long ptr long ptr)
|
@ stdcall ObjectFromLresult(long ptr long ptr)
|
||||||
@ stub WindowFromAccessibleObject
|
@ stdcall WindowFromAccessibleObject(ptr ptr)
|
||||||
|
|
|
@ -410,6 +410,9 @@ static void test_default_client_accessible_object(void)
|
||||||
hr = IOleWindow_GetWindow(ow, &hwnd2);
|
hr = IOleWindow_GetWindow(ow, &hwnd2);
|
||||||
ok(hr == S_OK, "got %x\n", hr);
|
ok(hr == S_OK, "got %x\n", hr);
|
||||||
ok(hwnd == hwnd2, "hwnd2 = %p, expected %p\n", hwnd2, hwnd);
|
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);
|
IOleWindow_Release(ow);
|
||||||
|
|
||||||
hr = IAccessible_get_accChildCount(acc, &l);
|
hr = IAccessible_get_accChildCount(acc, &l);
|
||||||
|
|
Loading…
Reference in New Issue