Почему WindowsAccessBridge-32.dll занимает много времени для итерации Java-элемента управления?

Использование WindowsAccessBridge-32.dll для получения списка информации об элементах управления Java. Пожалуйста, посмотрите ниже пример для того же.
Также возьмите руководство по ссылке ниже.https://docs.oracle.com/javase/accessbridge/2.0.2/setup.htm

Обнаружена серьезная проблема с производительностью при использовании двух разных «WindowsAccessBridge-32.dll» и «WndowsAccessBridge.dll». Основные данные о производительности в «Oracle E-Business Suite».

введите описание изображения здесь

Системная информация Windows-8 64-разрядная ОС и JRE 1.8 32-разрядная

Пожалуйста, дайте мне знать, что не так в коде ниже?

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;

namespace JavaTree
{
class JAB
{
private int _VMID = 0;
public List<string> JavaObjectRoleList;
public JAB()
{
JavaObjectRoleList = new List<string>();
Windows_run();
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct AccessibleContextInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string Name;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string Description;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string Role;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string Role_en_US;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string States;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string States_en_US;

[MarshalAs(UnmanagedType.I4)]
public int IndexInParent;
[MarshalAs(UnmanagedType.I4)]
public int ChildrenCount;
[MarshalAs(UnmanagedType.I4)]
public int X;
[MarshalAs(UnmanagedType.I4)]
public int Y;
[MarshalAs(UnmanagedType.I4)]
public int Width;
[MarshalAs(UnmanagedType.I4)]
public int Height;

[MarshalAs(UnmanagedType.Bool)]
public bool AccessibleComponent;
[MarshalAs(UnmanagedType.Bool)]
public bool AccessibleAction;
[MarshalAs(UnmanagedType.Bool)]
public bool AccessibleSelection;
[MarshalAs(UnmanagedType.Bool)]
public bool AccessibleText;
[MarshalAs(UnmanagedType.Bool)]
public bool AccessibleInterfaces;
};

[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint(System.Drawing.Point p);

const string WinAccessBridgeDll = @"WindowsAccessBridge-32.dll";

[DllImport(WinAccessBridgeDll, SetLastError = true, ThrowOnUnmappableChar = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
extern static void Windows_run();

[DllImport(WinAccessBridgeDll, SetLastError = true, ThrowOnUnmappableChar = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
extern static bool getAccessibleContextFromHWND(IntPtr handle, out int virtualMachineId, out Int64 accessibleContex);

[DllImport(WinAccessBridgeDll, SetLastError = true, ThrowOnUnmappableChar = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
extern static bool getAccessibleContextAt(int virtualMachineID, Int64 accessibleContext, int x, int y, out Int64 context);

[DllImport(WinAccessBridgeDll, SetLastError = true, ThrowOnUnmappableChar = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
extern static bool getAccessibleContextInfo(int virtualMachineID, Int64 accessibleContext, out AccessibleContextInfo contextInfo);

[DllImport(WinAccessBridgeDll, SetLastError = true, ThrowOnUnmappableChar = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
extern static Int64 getAccessibleChildFromContext(int virtualMachineID, Int64 accessibleContext, int index);

[DllImport(WinAccessBridgeDll, SetLastError = true, ThrowOnUnmappableChar = true, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
extern static bool getVirtualAccessibleName(int vmid, Int64 ac, StringBuilder name, int len);public void GetjavaObject(Point p)
{
IntPtr hwnd = WindowFromPoint(p);

long MainAc = 0;

getAccessibleContextFromHWND(hwnd, out _VMID, out MainAc);

IterateTree(MainAc);
}

void IterateTree(long controlac)
{
AccessibleContextInfo info, info1;
getAccessibleContextInfo(_VMID, controlac, out info);

for (int i = 0; i < info.ChildrenCount; i++)
{
long obj = getAccessibleChildFromContext(_VMID, controlac, i);
getAccessibleContextInfo(_VMID, obj, out info1);

string realname = info1.Name;
if (string.IsNullOrEmpty(info1.Name))
{
StringBuilder name = new StringBuilder(1024);
getVirtualAccessibleName(_VMID, controlac, name, 1024);
realname = name.ToString();
}
JavaObjectRoleList.Add(realname);

IterateTree(obj);
}
}
}
}

Спасибо,

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector