views:

105

answers:

1

Hi there,

I'm wondering if MSAA is COM-based, then one should be able to use CreateObject("Accessibility") to create an instance and call its methods. I had no success doing that. I have "OLEACC.DLL" in SYSTEM32 and it's registered with Windows. But the CreateObject fails.

Any thoughts?

I would like to use functions like AccessibleObjectFromPoint() to get the IAccessible object of the control at the given point.

Has anybody had such an experience?

Any input would be highly appreciated,

Thanks,

Kamil

A: 

MSAA is COM based. However, there is no co-creatable class exposed, it exposes only interfaces. That's the reason you can't do CreateObject().

The MSAA-exposed APIs, like AccessibleObjectFromPoint and AccessibleObjectFromWindow are dll-exported C++ methods. You can use them from C++ by linking the proper lib or doing LoadLibrary/GetProcAddress with the function name. From C#, you can get the P/nvoke declaration for these from Pinvoke.net. For example, here's the DllImport for AccessibleObjectFromWindow.

Franci Penov
Thanks Franci, Does this mean that MSAA can not be accessed via VBScript? By the way, when I add a reference to the OLEACC.DLL, Object Browser shows an exposed "CAccPropServices" class. Doesn't it mean that this class is co-creatable? I understand that the before-mentioned function (AccessibleObject...) is not a method of this calss but I would also like to use the "SetHwndPropStr" which is a method of this class. Cheers, Kamil –
kamilimak
I am not aware of a way to access MSAA through VBScript. As far as the CAccPropServices coclass, even if a class is exposed in the type library, that does not mean there is a class factory that can create it for you. Btw, as far as I am aware, this class is not intended for direct use by applications.
Franci Penov