我有一个结构,没有像原来的C那样充分描述。
public class DISPLAY_DEVICE extends Structure {
public char DeviceName[] = new char[32];
public int StateFlags;
}
Whereas it actually needs, way, more variables. However it will take me a long time to port them all over. Now I create the struct and pass the pointer to a dll function, and try to use device.read(); to regain the variables. However, the variables return empty. So my question is, do I need to fill out the whole struct? Or is there something else wrong?
DISPLAY_DEVICE displayDevice = new DISPLAY_DEVICE();
int i = 0;
while((CLibrary.INSTANCE.EnumDisplayDevicesA(Pointer.NULL, i, displayDevice.getPointer(), 0))) {
System.out.println("screen" + i);
displayDevice.read();
System.out.println(displayDevice.StateFlags);
System.out.println(displayDevice.DeviceName);