|
-
December 1st, 2004, 12:15 AM
#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.
-
February 22nd, 2005, 04:40 AM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|