Note: The goal of this is to get the dimensions of Google's "Search" box, which can't normally be obtained with GetWindowRect_() as it's not a Windows item. I've read online that AccessibleObjectFromPoint can probably do it, hence this request for help. It should be possible because I can get the text in the Google "Search" box with AccessibleObjectFromPoint, but not the dimensions of the box.
Code: Select all
CoInitialize_(0)
Prototype.l ProtoAccessibleObjectFromPoint(x.l,y.l,*ia,*var)
Global AccessibleObjectFromPoint.ProtoAccessibleObjectFromPoint
AccessibleObjectFromPoint=GetFunction(OpenLibrary(#PB_Any,"Oleacc.dll"),"AccessibleObjectFromPoint")
Procedure GetItemDimensions()
Protected CursorPos.Point
Protected handle
Protected *pIAcc.IAccessible
Protected vt.VARIANT
Protected s.s
GetCursorPos_(@CursorPos)
If AccessibleObjectFromPoint(CursorPos\x,CursorPos\y,@*pIAcc,@vt)=#S_OK
; Get the item dimensions here, somehow... :(
EndIf
*pIAcc\Release()
ProcedureReturn #Null
EndProcedure
Sleep_(2000) ; Give user time to hover over the "Search" box.
GetItemDimensions()