I am making an application which intends to behave like inspect.exe
. I have a treeview of accessibility elements which are queried on demand as the user navigates through the elements. I want to implement the 'Watch Cursor' feature now.
I can obtain the currently hovered element using AccessibleObjectFromPoint
. And I can call IAccessible::get_accParent
until I reach the intersection point with my existing elements shown in the treeview. However, the object returned from this function is different to the object pointers returned from this property are different to the ones in my treeview representing the same UI element.
How do you go about comparing 2 elements and understanding whether they are equal?
Is there some UID that I can obtain from the IAccessible (or a similar interface) which can be used to uniquely identify elements?
This is what IAccIdentity::GetIdentityString
is for.
IUnknown::QueryInterface
for IAccIdentity
(IID: {7852B78D-1CFD-41C1-A615-9C0C85960B5F}
)IAccIdentity::GetIdentityString
with dwIDChild
param set to 0
memcmp
on the returned buffers.additionally remember to call CoTaskMemFree
after copying the identity string into memory.