Piotr Caban : oleacc: Add WindowFromAccessibleObject implementation.
Alexandre Julliard
julliard at winehq.org
Thu May 15 15:14:31 CDT 2014
Module: wine
Branch: master
Commit: 6bd87c6bdbd91fb16fc6db746544adbfe57aa896
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6bd87c6bdbd91fb16fc6db746544adbfe57aa896
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu May 15 17:53:43 2014 +0200
oleacc: Add WindowFromAccessibleObject implementation.
---
dlls/oleacc/main.c | 34 ++++++++++++++++++++++++++++++++++
dlls/oleacc/oleacc.spec | 2 +-
dlls/oleacc/tests/main.c | 3 +++
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/dlls/oleacc/main.c b/dlls/oleacc/main.c
index 37d2269..9d5320e 100644
--- a/dlls/oleacc/main.c
+++ b/dlls/oleacc/main.c
@@ -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)
{
diff --git a/dlls/oleacc/oleacc.spec b/dlls/oleacc/oleacc.spec
index 679ba1a..caeb6d3 100644
--- a/dlls/oleacc/oleacc.spec
+++ b/dlls/oleacc/oleacc.spec
@@ -19,4 +19,4 @@
@ stub LIBID_Accessibility
@ stdcall LresultFromObject(ptr long ptr)
@ stdcall ObjectFromLresult(long ptr long ptr)
-@ stub WindowFromAccessibleObject
+@ stdcall WindowFromAccessibleObject(ptr ptr)
diff --git a/dlls/oleacc/tests/main.c b/dlls/oleacc/tests/main.c
index dde2786..dbe8706 100644
--- a/dlls/oleacc/tests/main.c
+++ b/dlls/oleacc/tests/main.c
@@ -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);
More information about the wine-cvs
mailing list