[英]Running sample Java app for JavaAccessability in C# with 64-bit Java SDK and 64-bit windows
我有一個示例Java應用程序,當我下載使用Java Accessibility(通過Java Access Bridge WindowsAccessBridge-32.dll
)的javaaccessablity-2.0.2
時獲得了。 盡管它成功調用了getAccessibleContextFromHWND
但它返回false
。 請注意,我獲得了通過檢查工具驗證的正確的hWnd值。
我在Windows 64位系統中安裝了64位Java SDK。 以下是我嘗試過的代碼。 我也嘗試過使用WindowsAccessBridge-64.dll,但它具有相同的行為,即vmID和_acParent返回為零而不是非零值。
class Program
{
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WindowsAccessBridge-32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static bool getAccessibleContextFromHWND(IntPtr hwnd, out Int32 vmID, out Int64 acParent);
[DllImport("WindowsAccessBridge-32.dll", CallingConvention = CallingConvention.Cdecl, ThrowOnUnmappableChar = true, CharSet = CharSet.Unicode)]
private extern static void Windows_run();
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
static void Main(string[] args)
{
Int32 vmID = 0;
Int64 _acParent =0;
Windows_run();
IntPtr hWnd = (IntPtr)FindWindow("SunAwtFrame","Standalone SwingApp");
bool retVal = getAccessibleContextFromHWND(hWnd, out vmID, out _acParent);
}
}
我讀過類似的文章,但並沒有解決我的問題。
我知道了。 與我們在構建涉及WindowsAccessBridge dll的項目時選擇正確的目標平台組合有關。 我們必須嘗試許多排列才能使其正常工作。
下面的鏈接提供了代碼,但是您仍然必須加載適當的dll才能正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.