0 Replies Latest reply on Mar 8, 2012 10:53 AM by 922559

    JavaAccessBridge setTextContents returns false

      From a C# program, I can read the text in Java textboxes (JTextArea, JTextField, TextArea). These texts are editable. When I call the setTextContents function, it always returns false; no error happens, Marshal.GetLastWin32Error() returns 0. How can the problem be resolved?

      Some code snippets used on my Win7 64bit machine (my application is running as a 32bit application, and the Java program was started with the 32bit java.exe):
      [DllImport(WinAccessBridgeDll, SetLastError = true, ThrowOnUnmappableChar = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
      public extern static unsafe Boolean setTextContents(Int32 vmID, Int64 AccessibleContext, string text);
      It does not matter which CharSet I use (tested all 4 available types).

      The context in which the function is called is:
      AccessibleTextItemsInfo textInfo = GetAccessibleTextItemsInfo(vmID, textbox, 0);
      MessageBox.Show("Der gegenwärtige Text lautet:\r\n" + textInfo.sentence);
      string replacement = "Laber laber blah blah!";
      if (!WABAPI.setTextContents(vmID, textbox.accessibleContext, replacement))
      int errorCode = Marshal.GetLastWin32Error();
      MessageBox.Show(string.Format("Ändern des Textes fehlgeschlagen mit code = {0}!", errorCode));