Skip to content
Prev Previous commit
Next Next commit
Clarification
  • Loading branch information
LeonarddeR committed Sep 18, 2021
commit 5fa7c01d69b5784a4fc6de3cae9da8b2064fd031
4 changes: 3 additions & 1 deletion source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1300,10 +1300,12 @@ def _getSelectedItemsCount_accSelection(self, maxCount):
enumObj=sel.QueryInterface(IEnumVARIANT)
if not enumObj:
raise NotImplementedError
# Some implementations of accSelection (e.g. in Symphony based products) don't return
# a fresh IEnumVARIANT. Reset it to ensure we enumerate from the start.
enumObj.Reset()
# Call the rawmethod for IEnumVARIANT::Next as COMTypes' overloaded version does not allow limiting the amount of items returned
numItemsFetched=ctypes.c_ulong()
itemsBuf=(VARIANT*(maxCount+1))()
enumObj.Reset()
res=enumObj._IEnumVARIANT__com_Next(maxCount,itemsBuf,ctypes.byref(numItemsFetched))
# IEnumVARIANT returns S_FALSE if the buffer is too small, although it still writes as many as it can.
# For our purposes, we can treat both S_OK and S_FALSE as success.
Expand Down