Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. JNA Java struct from pointer
  2. public class DISPLAY_DEVICE extends Structure {
  3.         public char DeviceName[] = new char[32];
  4.         public int StateFlags;
  5.     }
  6.        
  7. DISPLAY_DEVICE displayDevice = new DISPLAY_DEVICE();
  8.     int i = 0;
  9.     while((CLibrary.INSTANCE.EnumDisplayDevicesA(Pointer.NULL, i, displayDevice.getPointer(), 0))) {
  10.         System.out.println("screen" + i);
  11.         displayDevice.read();
  12.         System.out.println(displayDevice.StateFlags);
  13.         System.out.println(displayDevice.DeviceName);
  14.        
  15. public class MyStruct extends Structure {
  16.    public char[] DeviceName = new char[32];
  17.    public char StateFlags;
  18.    public byte[] dontcare = new char[128];
  19. }