In C#.net code, have been trying to use the interface- getAccessibleContextAt
in the following manner.
- For the Java application in concern, I identify the main windows-handle
- I get the pointer for the application context and the vmid using
getAccessibleContextFromHWND
. These are non zero andgetAccessibleContextFromHWND
returns true. - With these values and mouse position (x,y) trying to fetch the context of the underlying control using the interface
getAccessibleContextAt
. This method returns true, but the pointer for the control is zero.
Here is the code I am using:
private void GetJavaElementDetails(IntPtr javaAppHandle, int x, int y)
{
if (JABHelper.isJavaWindow(javaAppHandle)==1)
{
Int32 vmid;
IntPtr appContextPointer, ctlContextPointer;
bool result = JABHelper.getAccessibleContextFromHWND(javaAppHandle, out vmid, out appContextPointer);
result = JABHelper.getAccessibleContextAt(vmid, appContextPointer, x, y, out ctlContextPointer);
AccessibleContextInfo acinfo = new AccessibleContextInfo();
IntPtr acinfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleContextInfo()));
Marshal.StructureToPtr(new AccessibleContextInfo(),acinfoPtr, true);
if (JABHelper.getAccessibleContextInfo(vmid, ctlContextPointer, acinfoPtr))
{
acinfo = (AccessibleContextInfo)Marshal.PtrToStructure(acinfoPtr, typeof(AccessibleContextInfo));
}
}
}
Where JABHelper is just a wrapper around the different interfaces exposed by the WindowsAccessBridge.dll.
ctlContextPointer- always happen to be zero. Any resolution for this issue will be highly appreciated. Also please let me know if I am doing something wrongly.