002a29b8dd
Derive from the `IAccessible2_2` insterface [1] instead of
directly from (its base interface) `IAccessible2` and
add dummy implementations for the corresponding methods
that return `E_NOTIMPL` to indicate that there's no
real implementation yet.
An actual implementations for at least
`CMAccessible::get_relationTargetsOfType`
is planned for a separate upcoming commit.
Support for the interface can be checked e.g.
in Accerciser's Python console:
Before:
>>> from comInterfaces import IAccessible2Lib as IA2
>>> focus.IAccessibleObject
<POINTER(IAccessible2) ptr=0x9667f24 at 6841850>
>>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2)
<POINTER(IAccessible2) ptr=0x9667f24 at 6822120>
>>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2_2)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\tools\cygwin\home\user\development\git\nvda\.venv\Lib\site-packages\comtypes\__init__.py", line 831, in QueryInterface
self.__com_QueryInterface(byref(iid), byref(p))
File "C:\tools\cygwin\home\user\development\git\nvda\source\monkeyPatches\comtypesMonkeyPatches.py", line 33, in __call__
return super().__call__(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ctypes.COMError: (-2147467262, 'No such interface supported', (None, None, None, 0, None))
With this commit in place:
>>> from comInterfaces import IAccessible2Lib as IA2
>>> focus.IAccessibleObject
<POINTER(IAccessible2) ptr=0x988c784 at 6363580>
>>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2)
<POINTER(IAccessible2) ptr=0x988c784 at c55d7b0>
>>> focus.IAccessibleObject.QueryInterface(IA2.IAccessible2_2)
<POINTER(IAccessible2_2) ptr=0x974d824 at 6847f80>
And calling one of the methods gives a "Not Implemented" COMError
as expected:
>>> ia2_2 = focus.IAccessibleObject.QueryInterface(IA2.IAccessible2_2)
>>> ia2_2.attribute("dummy")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\tools\cygwin\home\user\development\git\nvda\.venv\Lib\site-packages\comtypes\_memberspec.py", line 482, in __call__
return self.fget(self.instance, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ctypes.COMError: (-2147467263, 'Not implemented', (None, None, None, 0, None))
[1]
|
||
---|---|---|
.. | ||
defines.idl | ||
UAccCOM.idl |