鼠标输入数据的Java等价物
我试图把C++ MouthIn输入数据结构转换成JNA。鼠标输入数据的Java等价物,java,c++,driver,Java,C++,Driver,我试图把C++ MouthIn输入数据结构转换成JNA。 typedef struct _MOUSE_INPUT_DATA { USHORT UnitId; USHORT Flags; union { ULONG Buttons; struct { USHORT ButtonFlags; USHORT ButtonData; }; }; ULONG RawButtons; LONG LastX; LONG L
typedef struct _MOUSE_INPUT_DATA {
USHORT UnitId;
USHORT Flags;
union {
ULONG Buttons;
struct {
USHORT ButtonFlags;
USHORT ButtonData;
};
};
ULONG RawButtons;
LONG LastX;
LONG LastY;
ULONG ExtraInformation;
} MOUSE_INPUT_DATA, *PMOUSE_INPUT_DATA;
我最好的猜测
public static class _MOUSE_INPUT_DATA extends Structure {
public static class ByReference extends _MOUSE_INPUT_DATA implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer memory) {
super(memory);
}
}
public _MOUSE_INPUT_DATA() {
}
public _MOUSE_INPUT_DATA(Pointer memory) {
super(memory);
read();
}
public WinDef.WORD unitId;
public WinDef.WORD flags;
public MOUSE_INPUT_DATA_UNION_STRUCT union = new MOUSE_INPUT_DATA_UNION_STRUCT();
public WinDef.ULONG rawButtons;
public WinDef.LONG lastX;
public WinDef.LONG lastY;
public BaseTSD.ULONG_PTR extraInformation;
protected List getFieldOrder() {
return Arrays.asList(new String[]{"unitId", "flags", "union", "rawButtons", "lastX", "lastY", "extraInformation"});
}
}
public static class MOUSE_INPUT_DATA_UNION_STRUCT extends Structure {
public static class ByReference extends MOUSE_INPUT_DATA_UNION_STRUCT implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer memory) {
super(memory);
}
}
public MOUSE_INPUT_DATA_UNION_STRUCT() {
}
public MOUSE_INPUT_DATA_UNION_STRUCT(Pointer memory) {
super(memory);
read();
}
public _MOUSE_INPUT_DATA_UNION_STUCT_DETAIL union = new _MOUSE_INPUT_DATA_UNION_STUCT_DETAIL();
protected List getFieldOrder() {
return Arrays.asList(new String[]{"union"});
}
public static class _MOUSE_INPUT_DATA_UNION_STUCT_DETAIL extends Union {
public _MOUSE_INPUT_DATA_UNION_STUCT_DETAIL() {
}
public _MOUSE_INPUT_DATA_UNION_STUCT_DETAIL(Pointer memory) {
super(memory);
read();
}
public WinDef.ULONG buttons;
public WinDef.ULONG flagsAndData;
}
}
我用它在自定义驱动程序中传递这个结构。我有一个Delphi应用程序,可以很好地使用驱动程序和这个结构,但JAVA不是
任何人都可以给我一些关于我哪里出错的提示?öimk_。我找到了中间结果
public class MOUSE_INPUT_DATA extends Structure {
public static class ByReference extends MOUSE_INPUT_DATA implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer memory) {
super(memory);
}
}
public MOUSE_INPUT_DATA() {
}
public MOUSE_INPUT_DATA(Pointer memory) {
super(memory);
read();
}
public WinDef.WORD UnitId;
public WinDef.WORD Flags;
public WinDef.DWORD Buttons;
public WinDef.DWORD RawButtons;
public WinDef.DWORD LastX;
public WinDef.DWORD LastY;
public WinDef.DWORD ExtraInformation;
protected List getFieldOrder() {
return Arrays.asList(new String[]{"UnitId", "Flags", "Buttons", "RawButtons", "LastX", "LastY", "ExtraInformation"});
}
}
ö洎。我找到了中间结果
public class MOUSE_INPUT_DATA extends Structure {
public static class ByReference extends MOUSE_INPUT_DATA implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer memory) {
super(memory);
}
}
public MOUSE_INPUT_DATA() {
}
public MOUSE_INPUT_DATA(Pointer memory) {
super(memory);
read();
}
public WinDef.WORD UnitId;
public WinDef.WORD Flags;
public WinDef.DWORD Buttons;
public WinDef.DWORD RawButtons;
public WinDef.DWORD LastX;
public WinDef.DWORD LastY;
public WinDef.DWORD ExtraInformation;
protected List getFieldOrder() {
return Arrays.asList(new String[]{"UnitId", "Flags", "Buttons", "RawButtons", "LastX", "LastY", "ExtraInformation"});
}
}
你考虑过了吗?没有。我需要将现有软件从Delphi移植到Java。它实际上需要很少的类型转换,因为它使用定制的驱动程序,并且一些DLLs.SWIG不生成结构代码。不幸的是,你考虑过吗?没有。我需要将现有软件从Delphi移植到Java。它实际上需要很少的类型转换,因为它使用定制的驱动程序,并且一些DLLs.SWIG不生成结构代码。不幸的是。