3 Replies Latest reply: Apr 9, 2013 6:18 AM by PhHein RSS

    [ Java Accessibility - Problem]

    843807
      I have a problem with Java Accessibility API with C#.
      I get the handle of my Applet with Spy++ and invoke the function GetAccessibleContextFromHWND (WindowsAccessBridge.dll).
      But the result pointer is -858993460 it's impossible! Then I invoke isJavaWindow and the result is FALSE! Why? the handle that I put is right! If I get an enumeration of the opened window and invoke isJavaWindow is always False! Why?

      Code:

      IntPtr HINSTANCE= SunAPI.LoadLibrary(SunAPI.PATH_WindowsAccessBridge+SunAPI.WindowsAccessBridge);
      SunAPI.Windows_run();
      long lng;
      return SunAPI.isJavaWindow(hwnd);

      SUNAPI.cs

      public class SunAPI
      {
      ...................
      ................

      [DllImport("kernel32.dll")]
      public static extern IntPtr LoadLibrary(string lpFileName);

      [DllImport("WindowsAccessBridge", CallingConvention =     CallingConvention.Cdecl)]
      public extern static void Windows_run();

      [DllImport("WindowsAccessBridge", CallingConvention =     CallingConvention.Cdecl)]CallingConvention.Cdecl)]
      public extern static bool isJavaWindow(IntPtr window);

      [DllImport("WindowsAccessBridge", CallingConvention =     CallingConvention.Cdecl)]CallingConvention.Cdecl)]
      public static extern IntPtr GetAccessibleContextFromHWND(IntPtr hwnd, out long vmID,IntPtr ac);

      [DllImport("User32.dll", SetLastError = true)]
      public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChild, string className, string windowName);

      }
      }