0 Replies Latest reply: May 7, 2008 2:27 PM by 843807 RSS

    VB.net and access point.

    843807
      I keep getting an error with the following 2 api calls: (GetAccessibleContextInfo entry point can not be found in windowsaccessbridge.dll) The other subs work fine I can click on a java form and the function fires correctly. I also get getversioninfo data correctly. Any help would be appreciated.
      <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
            Public Shared Function GetAccessibleContextInfo(ByVal vmID As Long, ByVal ac As IntPtr, ByRef info As AccessibleContextInfo) As Boolean
          End Function
            <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
          Private Shared Function GetAccessibleContextFromHWND(ByVal hwnd As IntPtr, ByRef vmID As Long, ByVal ac As IntPtr) As IntPtr
          End Function
      Imports System
      Imports System.Runtime.InteropServices
      Public Class Form1
          Dim StarPTR As Long = 0
          <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
          Private Shared Function GetWindowText(ByVal hwnd As IntPtr, _
                                 ByVal lpString As System.Text.StringBuilder, _
                                 ByVal cch As Integer) As Integer
          End Function
          <DllImport("kernel32.dll", SetLastError:=True, CharSet:=CharSet.Unicode, EntryPoint:="LoadLibraryW")> _
          Public Shared Function LoadLibrary(ByVal lpFileName As String) As IntPtr
          End Function
          Dim StarVIMID As Long
          Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
              Dim ps() As Process = Process.GetProcesses()
              Dim p As Process
              Dim WindowsHandle As Long = 0
              Dim HINSTANCE As IntPtr = LoadLibrary("WindowsAccessBridge.dll")
              Windows_run()
              For Each p In ps
                  If p.MainWindowTitle = "Star_Student V3e 0706" Then
                      StarPTR = p.MainWindowHandle
                  End If
                  'Dim tmpboolean As Boolean = SUNAPI.isJavaWindow(StarPTR)
                  'If tmpboolean = True Then
                  '    StarPTR = p.MainWindowHandle
                  'End If
              Next
              '' Dim tmpboolean As Boolean = SUNAPI.isJavaWindow(StarPTR)
      
              'Dim strString As New System.Text.StringBuilder(256)
              'Dim intTotal As Integer
              'intTotal = GetWindowText(StarPTR, strString, 500)
      
              Dim theVMID As Integer
              Dim ac As IntPtr
              Dim bln As Boolean = False
      
              bln = GetAccessibleContextFromHWND(StarPTR, theVMID, ac)
              Dim mcd As MouseClickedDelegate
              mcd = New MouseClickedDelegate(AddressOf HandleMouseClicked)
      
              setMouseClickedFP(mcd)
      
          End Sub
          <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
          Private Shared Sub Windows_run()
          End Sub
          <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
            Public Shared Function GetAccessibleContextInfo(ByVal vmID As Long, ByVal ac As IntPtr, ByRef info As AccessibleContextInfo) As Boolean
          End Function
          <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
          Private Shared Function isJavaWindow(ByVal window As IntPtr) As Boolean
          End Function
      
          <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
          Private Shared Function GetAccessibleContextFromHWND(ByVal hwnd As IntPtr, ByRef vmID As Long, ByVal ac As IntPtr) As IntPtr
          End Function
      
      
          <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
          Private Shared Sub setMouseClickedFP(ByVal fp As MouseClickedDelegate)
          End Sub
      
          <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
          Private Shared Sub releaseJavaObject(ByVal vmID As Integer, ByVal javaObject As IntPtr)
          End Sub
      
          <DllImport("WindowsAccessBridge.dll", CallingConvention:=CallingConvention.Cdecl)> _
          Private Shared Sub getVersionInfo(ByVal vmID As Integer, ByRef v As VersionInfo)
          End Sub
      
          <UnmanagedFunctionPointer(CallingConvention.Cdecl)> _
       Delegate Sub MouseClickedDelegate(ByVal vmID As Integer, ByVal jevent As IntPtr, ByVal ac As IntPtr)
          Shared mcd As MouseClickedDelegate
          ' so delegate won't get gc'd
          <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
          Structure VersionInfo
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private VMversion As String
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private bridgeJavaClassVersion As String
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private bridgeJavaDLLVersion As String
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private bridgeWinDLLVersion As String
          End Structure
          Private Shared vi As New VersionInfo()
      
          Public Shared aci As New AccessibleContextInfo()
      
          Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
         
          End Sub
      
          Private Shared Sub HandleMouseClicked(ByVal vmID As Integer, ByVal jevent As IntPtr, ByVal ac As IntPtr)
      
              getVersionInfo(vmID, vi)
              Dim t As Boolean = isJavaWindow(Form1.StarPTR)
              'GetAccessibleContextFromHWND(Form1.StarPTR, vmID, ac)
              Form1.StarVIMID = vmID
            
              releaseJavaObject(vmID, ac)
              releaseJavaObject(vmID, jevent)
          End Sub
          <StructLayout(LayoutKind.Sequential)> _
          Public Structure AccessibleContextInfo
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private name As String
              ' the AccessibleName of the object
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private description As String
              ' the AccessibleDescription of the object
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private role As String
              ' localized AccesibleRole string
              <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
              Private states As String
              ' localized AccesibleStateSet string
              ' (comma separated)
              <MarshalAs(UnmanagedType.SysInt)> _
            Private indexInParent As Integer
      
              ' index of object in parent
              <MarshalAs(UnmanagedType.SysInt)> _
              Private childrenCount As Integer
              ' # of children, if any
              <MarshalAs(UnmanagedType.SysInt)> _
              Private x As Integer
              ' screen coords in pixels
              <MarshalAs(UnmanagedType.SysInt)> _
              Private y As Integer
              ' "
              <MarshalAs(UnmanagedType.SysInt)> _
              Private width As Integer
              ' pixel width of object
              <MarshalAs(UnmanagedType.SysInt)> _
              Private height As Integer
              ' pixel height of object
              <MarshalAs(UnmanagedType.Bool, SizeConst:=256)> _
            Private accessibleComponent As Boolean
      
              ' flags for various additional
              <MarshalAs(UnmanagedType.Bool, SizeConst:=256)> _
              Private accessibleAction As Boolean
              ' Java Accessibility interfaces
              <MarshalAs(UnmanagedType.Bool, SizeConst:=256)> _
              Private accessibleSelection As Boolean
              ' FALSE if this object doesn't
              <MarshalAs(UnmanagedType.Bool, SizeConst:=256)> _
              Private accessibleText As Boolean
              ' implement the additional interface
              <MarshalAs(UnmanagedType.Bool, SizeConst:=256)> _
              Private accessibleValue As Boolean
              ' in question
          End Structure
      
      End Class
      
      {code}