私はC++で次の構造を持っています。C#で定義したいと思います。どうやってするか。誰にでも思いはある
typedef struct AccessibleTableInfoTag {
JOBJECT64 caption; // AccesibleContext
JOBJECT64 summary; // AccessibleContext
jint rowCount;
jint columnCount;
JOBJECT64 accessibleContext;
JOBJECT64 accessibleTable;
} AccessibleTableInfo;
AccessibleTableInfo タグを C# で変換するには、次の方法で試しました。しかし、うまくいきません。
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct AccessibleTableInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string caption;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string summary;
[MarshalAs(UnmanagedType.I4)]
public int rowCount;
[MarshalAs(UnmanagedType.I4)]
public int columnCount;
[MarshalAs(UnmanagedType.LPStruct)]
public AccessibleContextInfo accessibleContext;
[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.LPStruct)]
public AccessibleContextInfo accessibleTable;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct AccessibleContextInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string name; // the AccessibleName of the object
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
public string description; // the AccessibleDescription of the object
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string role; // localized AccesibleRole string
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string role_en_US; // AccesibleRole string in the en_US locale
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string states; // localized AccesibleStateSet string (comma separated)
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string states_en_US; // AccesibleStateSet string in the en_US locale (comma separated)
public Int32 indexInParent; // index of object in parent
public Int32 childrenCount; // # of children, if any
public Int32 x; // screen coords in pixels
public Int32 y; // "
public Int32 width; // pixel width of object
public Int32 height; // pixel height of object
public Boolean accessibleComponent; // flags for various additional
public Boolean accessibleAction; // Java Accessibility interfaces
public Boolean accessibleSelection; // FALSE if this object doesn't
public Boolean accessibleText; // implement the additional interface
// in question
// BOOL accessibleValue; // old BOOL indicating whether AccessibleValue is supported
public Boolean accessibleInterfaces; // new bitfield containing additional interface flags
}
しかし、うまくいきません。