Skip to content

Instantly share code, notes, and snippets.

@alexanderfloh
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save alexanderfloh/aa6333901d0d328645de to your computer and use it in GitHub Desktop.

Select an option

Save alexanderfloh/aa6333901d0d328645de to your computer and use it in GitHub Desktop.

Revisions

  1. alexanderfloh revised this gist Jan 15, 2015. 1 changed file with 4 additions and 7 deletions.
    11 changes: 4 additions & 7 deletions accessibility
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    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
    @@ -23,7 +25,7 @@ Public Module Main
    Dim _desktop As Desktop = Agent.Desktop

    Public Sub Main()
    Dim varChildID As Object
    Dim varChildID As Object
    Dim accObj As IAccessible

    'The point Of the control that are interested In
    @@ -35,13 +37,8 @@ Public Module Main
    AccessibleObjectFromPoint(pt, accObj, varChildID)

    For i As Integer = 1 To 100
    Console.WriteLine("Iteration " & i & ":"+accObj.get_accValue(0))
    'Debug.Write(index.ToString & " ")
    Workbench.ResultComment("Iteration " & i & ":"+accObj.accValue)
    Next

    'For (int i = 0; i < 100; i++)
    '{
    ' Console.WriteLine("Iteration "+i+":"+accObj.get_accValue(0))
    '}
    End Sub
    End Module
  2. alexanderfloh created this gist Jan 15, 2015.
    47 changes: 47 additions & 0 deletions accessibility
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    Imports System.Runtime.InteropServices
    Imports Accessibility

    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
    Console.WriteLine("Iteration " & i & ":"+accObj.get_accValue(0))
    'Debug.Write(index.ToString & " ")
    Next

    'For (int i = 0; i < 100; i++)
    '{
    ' Console.WriteLine("Iteration "+i+":"+accObj.get_accValue(0))
    '}
    End Sub
    End Module