From 085fc00f8131e2adaae601f5ffbdf2728edeb06a Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 4 Jan 2015 01:13:35 -0500 Subject: [PATCH] Added the standard accessible object, added it to a few navigation-related places to make Inspect.exe's life easier, and added some more get_accName() debug stuff. --- winapi_windows.h | 1 + wintable/new/accessibility.h | 18 ++++++++++++++---- wintable/new/main.c | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/winapi_windows.h b/winapi_windows.h index b6b436a..651d7ca 100644 --- a/winapi_windows.h +++ b/winapi_windows.h @@ -9,6 +9,7 @@ #define STRICT #define STRICT_TYPED_ITEMIDS #define CINTERFACE +#define COBJMACROS // get Windows version right; right now Windows XP #define WINVER 0x0501 #define _WIN32_WINNT 0x0501 diff --git a/wintable/new/accessibility.h b/wintable/new/accessibility.h index e5f3f68..1968666 100644 --- a/wintable/new/accessibility.h +++ b/wintable/new/accessibility.h @@ -4,7 +4,7 @@ struct tableAcc { IAccessibleVtbl *vtbl; ULONG refcount; struct table *t; - // TODO create a standard accessible object + IAccessible *std; }; #define TA ((struct tableAcc *) this) @@ -38,6 +38,7 @@ static ULONG STDMETHODCALLTYPE tableAccRelease(IAccessible *this) { TA->refcount--; if (TA->refcount == 0) { + IAccessible_Release(TA->std); tableFree(TA, "error freeing Table accessibility object"); return 0; } @@ -103,12 +104,14 @@ static HRESULT STDMETHODCALLTYPE tableAccget_accName(IAccessible *this, VARIANT printf("tableAccget_accName()\n"); // TODO check pointer if (varChild.vt != VT_I4) { +printf("invalid arg\n"); *pszName = NULL; return E_INVALIDARG; } if (varChild.lVal == CHILDID_SELF) ; // TODO standard accessible object // TODO actually get the real name +printf("returning name\n"); *pszName = SysAllocString("This is a test of the accessibility interface."); // TODO check null pointer return S_OK; @@ -183,19 +186,19 @@ static HRESULT STDMETHODCALLTYPE tableAccaccSelect(IAccessible *this, long flags static HRESULT STDMETHODCALLTYPE tableAccaccLocation(IAccessible *this, long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild) { // TODO - return DISP_E_MEMBERNOTFOUND; + return IAccessible_accLocation(TA->std, pxLeft, pyTop, pcxWidth, pcyHeight, varChild); } static HRESULT STDMETHODCALLTYPE tableAccaccNavigate(IAccessible *this, long navDir, VARIANT varStart, VARIANT *pvarEndUpAt) { // TODO - return DISP_E_MEMBERNOTFOUND; + return IAccessible_accNavigate(TA->std, navDir, varStart, pvarEndUpAt); } static HRESULT STDMETHODCALLTYPE tableAccaccHitTest(IAccessible *this, long xLeft, long yTop, VARIANT *pvarChild) { // TODO - return DISP_E_MEMBERNOTFOUND; + return IAccessible_accHitTest(TA->std, xLeft, yTop, pvarChild); } static HRESULT STDMETHODCALLTYPE tableAccaccDoDefaultAction(IAccessible *this, VARIANT varChild) @@ -250,11 +253,18 @@ static const IAccessibleVtbl tableAccVtbl = { static struct tableAcc *newTableAcc(struct table *t) { struct tableAcc *ta; + HRESULT hr; + IAccessible *std; ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object"); ta->vtbl = &tableAccVtbl; ta->vtbl->AddRef(ta); ta->t = t; + hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, &std); + if (hr != S_OK) + // TODO panichresult + panic("error creating standard accessible object for Table"); + ta->std = std; return ta; } diff --git a/wintable/new/main.c b/wintable/new/main.c index c5a8346..e4d136c 100644 --- a/wintable/new/main.c +++ b/wintable/new/main.c @@ -4,6 +4,7 @@ #define STRICT #define STRICT_TYPED_ITEMIDS #define CINTERFACE +#define COBJMACROS // get Windows version right; right now Windows XP #define WINVER 0x0501 #define _WIN32_WINNT 0x0501