Skip to content

Instantly share code, notes, and snippets.

@alexanderfloh
Last active August 29, 2015 14:13
Show Gist options
  • Save alexanderfloh/aa6333901d0d328645de to your computer and use it in GitHub Desktop.
Save alexanderfloh/aa6333901d0d328645de to your computer and use it in GitHub Desktop.
acc
Imports System.Runtime.InteropServices
Imports Accessibility
'add reference to "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Accessibility.dll"
Public Module Main
<DllImport("oleacc.dll")> _
Function AccessibleObjectFromPoint(ByVal pt As Point, <MarshalAs(UnmanagedType.Interface)> ByRef accObj As IAccessible, ByRef ChildID As Object) As IntPtr
End Function
<System.Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> _
Public Structure POINT
Public X As Integer
Public Y As Integer
Public Sub New(ByVal X As Integer, ByVal Y As Integer)
Me.X = X
Me.Y = Y
End Sub
End Structure
Dim _desktop As Desktop = Agent.Desktop
Public Sub Main()
Dim varChildID As Object
Dim accObj As IAccessible
'The point Of the control that are interested In
Dim pt As POINT = New POINT(50, 196)
'Make app active
System.Threading.Thread.Sleep(3000)
AccessibleObjectFromPoint(pt, accObj, varChildID)
For i As Integer = 1 To 100
Workbench.ResultComment("Iteration " & i & ":"+accObj.accValue)
Next
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment