CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2004
    Posts
    1

    WindowsAccessBridge in .Net (Java Accessibility)

    Hi!

    I want to use an API "GetAccessibleContextInfo" in my C# code to collect control information from a java window. This API call works fine in Delphi but not in C#. The API reads like this:

    BOOL GetAccessibleContextInfo(long vmID, AccessibleContext ac, AccessibleContextInfo *info);
    where;

    vmID = output from the API [BOOL GetAccessibleContextFromHWND(HWND target, long *vmID, AccessibleContext *ac)]. //This works fine.
    ac = output from the above API. //This also works fine.

    *info = this makes the problem. AccessibleContextInfo is a structure.

    But how can I replace the above pointer to a corresponding C# code?
    Tried with IntPtr, Void*, etc.. but no use...
    How can I point to the structure defined or how can I Marshal the pointer to a structure?

    Any idea?

    regrds
    Ganesh.

  2. #2
    Join Date
    Feb 2005
    Posts
    1

    Re: WindowsAccessBridge in .Net (Java Accessibility)

    ok first of AccessibleContextInfo is a struct that you have to marshal in C# in order to allow the dll to fill it, so
    here is the struct

    [StructLayout(LayoutKind.Sequential)]
    public struct AccessibleContextInfo
    {
    string name; // the AccessibleName of the object
    string description; // the AccessibleDescription of the object

    string role; // localized AccesibleRole string
    string states; // localized AccesibleStateSet string
    // (comma separated)

    long indexInParent; // index of object in parent
    long childrenCount; // # of children, if any
    long x; // screen coords in pixels
    long y; // "
    long width; // pixel width of object
    long height; // pixel height of object

    bool accessibleComponent; // flags for various additional
    bool accessibleAction; // Java Accessibility interfaces
    bool accessibleSelection; // FALSE if this object doesn't
    bool accessibleText; // implement the additional interface
    bool accessibleValue; // in question
    };

    now, instead of sending a general pointer or an object , send a ref to a variable of the struct

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured