gpt4 book ai didi

MOUSE_INPUT_DATA 的 Java 等价物

转载 作者:太空宇宙 更新时间:2023-11-04 13:22:21 25 4
gpt4 key购买 nike

我正在尝试将 C++ MOUSE_INPUT_DATA 结构转换为 JNA。

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 不是。

谁能给我一些提示,告诉我哪里错了?

最佳答案

Ок.我找到了中间结果。

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"});
}

}

关于MOUSE_INPUT_DATA 的 Java 等价物,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34716161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com