C# - System.Windows.Automation with Java, Java Access Bridge with WindowsAccessBridge.dll
-
Hello, I need to do some gui automation work with Java from C#. I apologize, there are two ways: 1/ throught .net 3.0 System.Windows.Automation, It seems to be incompatible with Java. 2/ throught Java Access Bridge throught interop with functions in WindowsAccessBridge.dll However, all called functions /isJavaWindow, getAccessibleContextAt, getAccessibleContextFromHWND, getAccessibleContextWithFocus/ are not working for me. Does anybody have any examples ? Gagy
-
Hello, I need to do some gui automation work with Java from C#. I apologize, there are two ways: 1/ throught .net 3.0 System.Windows.Automation, It seems to be incompatible with Java. 2/ throught Java Access Bridge throught interop with functions in WindowsAccessBridge.dll However, all called functions /isJavaWindow, getAccessibleContextAt, getAccessibleContextFromHWND, getAccessibleContextWithFocus/ are not working for me. Does anybody have any examples ? Gagy
Hi Greg, Please use below code using System.Runtime.InteropServices; using System; using System.Collections.Generic; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; namespace JabApiLib.JavaAccessBridge { public static class JabHelpers { public class AccessibleTreeItem { public String name; // the AccessibleName of the object public String description; // the AccessibleDescription of the object public String role; // localized AccesibleRole string public String role_en_US; // AccesibleRole string in the en_US locale public String states; // localized AccesibleStateSet string (comma separated) public String states_en_US; // AccesibleStateSet string in the en_US locale (comma separated) public Int32 indexInParent; // index of object in parent public Int32 childrenCount; // # of children, if any public Int32 x; // screen coords in pixel public Int32 y; // " public Int32 width; // pixel width of object public Int32 height; // pixel height of object public Boolean accessibleComponent; // flags for various additional public Boolean accessibleAction; // Java Accessibility interfaces public Boolean accessibleSelection; // FALSE if this object doesn't public Boolean accessibleText; // implement the additional interface public Boolean accessibleInterfaces; public string textValue; public string m_msgStr; public List children; public AccessibleTreeItem() { children = new List(); } public AccessibleTreeItem(AccessibleContextInfo accessibleContextInfo) : this() { this.name = accessibleContextInfo.name; // the AccessibleName of the object this.description = accessibleContextInfo.description; // the AccessibleDescription of the object this.role = accessibleContextInfo.role; // localized AccesibleRole string this.role_en_US = accessibleContextInfo.role_en_US; // AccesibleRole string in the en_US locale this.states = accessibleContextInfo.states; // localized AccesibleStateSet string (comma separated) this.states_en_US = accessibleContextInfo.state
-
Hi Greg, Please use below code using System.Runtime.InteropServices; using System; using System.Collections.Generic; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; namespace JabApiLib.JavaAccessBridge { public static class JabHelpers { public class AccessibleTreeItem { public String name; // the AccessibleName of the object public String description; // the AccessibleDescription of the object public String role; // localized AccesibleRole string public String role_en_US; // AccesibleRole string in the en_US locale public String states; // localized AccesibleStateSet string (comma separated) public String states_en_US; // AccesibleStateSet string in the en_US locale (comma separated) public Int32 indexInParent; // index of object in parent public Int32 childrenCount; // # of children, if any public Int32 x; // screen coords in pixel public Int32 y; // " public Int32 width; // pixel width of object public Int32 height; // pixel height of object public Boolean accessibleComponent; // flags for various additional public Boolean accessibleAction; // Java Accessibility interfaces public Boolean accessibleSelection; // FALSE if this object doesn't public Boolean accessibleText; // implement the additional interface public Boolean accessibleInterfaces; public string textValue; public string m_msgStr; public List children; public AccessibleTreeItem() { children = new List(); } public AccessibleTreeItem(AccessibleContextInfo accessibleContextInfo) : this() { this.name = accessibleContextInfo.name; // the AccessibleName of the object this.description = accessibleContextInfo.description; // the AccessibleDescription of the object this.role = accessibleContextInfo.role; // localized AccesibleRole string this.role_en_US = accessibleContextInfo.role_en_US; // AccesibleRole string in the en_US locale this.states = accessibleContextInfo.states; // localized AccesibleStateSet string (comma separated) this.states_en_US = accessibleContextInfo.state
Hi , How to click a button using Java Access Bridge with WindowsAccessBridge.dll (C#.net). Please share me complete code for below two classes. 1)AccessibleActionsToDo 2)AccessibleActions AccessibleActionsToDo actions_to_do; int temp2 = Marshal.SizeOf(new AccessibleActions()); IntPtr accessible_action_ptr = Marshal.AllocHGlobal(temp2); JabApi.getAccessibleActions(vmID, currentPtr, accessible_action_ptr); AccessibleActions actions1 = (AccessibleActions)Marshal.PtrToStructure(accessible_action_ptr, typeof(AccessibleActions)); actions_to_do.actionsCount = actions1.actionsCount; actions_to_do.actions = actions1.actionInfo; int temp3 = Marshal.SizeOf(new AccessibleActionsToDo()); IntPtr accessible_action_ptr1 = Marshal.AllocHGlobal(temp3); JabApi.MouseClickedDelegate mcd1 = new JabApi.MouseClickedDelegate(HandleMouseClicked); int fp = 0; JabApi.setMouseClickedFP(null); Marshal.StructureToPtr(actions_to_do, accessible_action_ptr1, false); JabApi.doAccessibleActions(vmID, currentPtr, accessible_action_ptr1, &failure); IntPtr Window_Handle = JabApi.getHWNDFromAccessibleContext(vmID, currentPtr);