Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6939359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:36:46+00:00 2026-05-27T12:36:46+00:00

I have a 32-bit app that makes use of Java Accessibility (WindowsAccessBridge-32.dll, via the

  • 0

I have a 32-bit app that makes use of Java Accessibility (WindowsAccessBridge-32.dll, via the Java Access Bridge), and works perfectly on a 32-bit machine, but fails on an x64 machine.

I believe I have tracked it down to one of the first calls after Windows_run:

getAccessibleContextFromHWND(hwnd, out vmId, out context)

defined as follows:

[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WindowsAccessBridge-32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static bool getAccessibleContextFromHWND(IntPtr hwnd, out Int32 vmID, out IntPtr acParent);

This call works fine on the 32-bit system, returning True, populating both vmId (with some 5-digit value, which), and context – whereas on the 64-bit system, it returns True, populates ‘context’, but returns ‘0’ for vmId.

If I assume that 0 is valid (even though it’s a random 5-digit number resembling a pointer on the 32-bit system), the next call still fails:

AccessibleContextInfo aci = new API.AccessibleContextInfo();
if (!getAccessibleContextInfo(vmId, context, ref aci))
  throw new Exception();

where:

[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("WindowsAccessBridge-32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static bool getAccessibleContextInfo(Int32 vmID, IntPtr ac, ref AccessibleContextInfo info);

(I’m omitting the AccessibleContextInfo struct for brevity, but I can provide it if necessary).

I know that the libraries are working, because both JavaMonkey and JavaFerret work correctly. Furthermore, call to isJavaWindow works, returning ‘true’, or ‘false’ as appropriate, and I am linking to the correct DLL (WindowsAccessBridge-32).

Can anyone suggest what may be wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:36:46+00:00Added an answer on May 27, 2026 at 12:36 pm

    It appears that the problem is in the type of AccessibilityContext:

    [return: MarshalAs(UnmanagedType.Bool)]
    [DllImport("WindowsAccessBridge-32.dll", CallingConvention = CallingConvention.Cdecl)]
    public extern static bool getAccessibleContextFromHWND(IntPtr hwnd, out Int32 vmID, out IntPtr acParent);
    

    AccessibilityContext (acParent above), which I had incorrectly mapped as an IntPtr, is actually an Int32 when using the “legacy” WindowsAccessBridge.dll library (used under x86), and an Int64 when using the WOW64 WindowsAccessBridge-32.dll library.

    So the upshot is, the code has to differ between x86 and WOW x64, and must be compiled separately for each. I do this by #define’ing WOW64 during x64 builds, always referencing the Int64 methods, and using “shim” methods on x86:

    #if WOW64 // using x64
    
    [return: MarshalAs(UnmanagedType.Bool)]
    [DllImport("WindowsAccessBridge-32.dll", CallingConvention = CallingConvention.Cdecl)]
    public extern static bool getAccessibleContextFromHWND(IntPtr hwnd, out Int32 vmID, out Int64 acParent);
    
    #else // using x86
    
    [return: MarshalAs(UnmanagedType.Bool)]
    [DllImport("WindowsAccessBridge.dll", EntryPoint = "getAccessibleContextFromHWND", CallingConvention = CallingConvention.Cdecl)]
    private extern static bool _getAccessibleContextFromHWND(IntPtr hwnd, out Int32 vmID, out Int32 acParent);
    
    public static bool getAccessibleContextFromHWND(IntPtr hwnd, out Int32 vmID, out Int64 acParent)
    {
      Int32 _acParent;
    
      bool retVal = _getAccessibleContextFromHWND(hwnd, out vmID, out _acParent);
      acParent = _acParent;
    
      return retVal;
    }
    
    #endif
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that makes use of the App trait, and it's all
I have a pyobjc app running in a 32-bit only python build that makes
I have a rails app that has picked up a bit of traction, but
This a bit of strange one.... We have an internal web app that runs
I have a .NET app which works in 32 and 64 bit. I would
I have a .NET 2.0 windows forms app, which makes heavy use of the
I am writing an app that may have in its memory quite a bit
I have a bit of a strange problem. I am trying to send in-app
i have bit of code that causes an underflow: var t1, t2, delta: DWORD:
I have a bit of code that basically reads an XML document using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.