以下のコードを実行すると、このエラーが発生します。
Exception in thread "AWT-EventQueue-0" java.lang.Error: Structure.getFieldOrder() on class javaapplication2.NewJFrame$APPBARDATA returns names ([cbSize, hWnd, jCallbackMessage, jEdge, rc, sParam]) which do not match declared field names ([])
at com.sun.jna.Structure.getFields(Structure.java:872)
at com.sun.jna.Structure.deriveLayout(Structure.java:983)
at com.sun.jna.Structure.calculateSize(Structure.java:908)
at com.sun.jna.Structure.calculateSize(Structure.java:896)
at com.sun.jna.Structure.allocateMemory(Structure.java:357)
at com.sun.jna.Structure.<init>(Structure.java:191)
at com.sun.jna.Structure.<init>(Structure.java:180)
at com.sun.jna.Structure.<init>(Structure.java:167)
at com.sun.jna.Structure.<init>(Structure.java:159)
at javaapplication2.NewJFrame$APPBARDATA.<init>(NewJFrame.java:31)
at javaapplication2.NewJFrame.<init>(NewJFrame.java:56)
at javaapplication2.NewJFrame$7.run(NewJFrame.java:255)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:682)
at java.awt.EventQueue$3.run(EventQueue.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
私のクラス:
class APPBARDATA extends Structure {
WinUser.DWORD cbSize;
WinUser.HWND hWnd;
WinUser.UINT_PTR uCallbackMessage;
WinUser.UINT_PTR uEdge;
WinUser.RECT rc;
WinUser.LPARAM lParam;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"cbSize", "hWnd", "uCallbackMessage", "uEdge", "rc", "lParam"});
}
}
APPBARDATA pdata = new APPBARDATA();
pdata.lParam = new WinUser.LPARAM(0);
pdata.cbSize = new WinUser.DWORD(32);
pdata.hWnd = WinUser.HWND_BROADCAST;
なにが問題ですか?