问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/1904402/msaa-com-based