public static class ULONG_PTR extends IntegerType {

    public ULONG_PTR() {
        this(0);
    }

    public ULONG_PTR(long value) {
        super(Pointer.SIZE, value, true);
    }

    public Pointer toPointer() {
        return Pointer.createConstant(longValue());
    }
} public static class HBRUSH extends HANDLE {

    /**
     * Instantiates a new hbrush.
     */
    public HBRUSH() {
    }

    /**
     * Instantiates a new hbrush.
     *
     * @param p the p
     */
    public HBRUSH(Pointer p) {
        super(p);
    }
} public static class HCURSOR extends HICON {

    /**
     * Instantiates a new hcursor.
     */
    public HCURSOR() {
    }

    /**
     * Instantiates a new hcursor.
     *
     * @param p the p
     */
    public HCURSOR(Pointer p) {
        super(p);
    }
} public static class HICON extends HANDLE {

    /**
     * Instantiates a new hicon.
     */
    public HICON() {
    }

    /**
     * Instantiates a new hicon.
     *
     * @param p the p
     */
    public HICON(Pointer p) {
        super(p);
    }
} public static class HINSTANCE extends HANDLE {
} public static class HWND extends HANDLE {

    /**
     * Instantiates a new hwnd.
     */
    public HWND() {
        super();
    }

    /**
     * Instantiates a new hwnd.
     *
     * @param p the p
     */
    public HWND(Pointer p) {
        super(p);
    }
} public static class LPARAM extends LONG_PTR {

    /**
     * Instantiates a new lparam.
     */
    public LPARAM() {
        this(0);
    }

    /**
     * Instantiates a new lparam.
     *
     * @param value the value
     */
    public LPARAM(long value) {
        super(value);
    }
} public static class LRESULT extends LONG_PTR {

    /**
     * Instantiates a new lresult.
     */
    public LRESULT() {
        this(0);
    }

    /**
     * Instantiates a new lresult.
     *
     * @param value the value
     */
    public LRESULT(long value) {
        super(value);
    }
} public static class WPARAM extends UINT_PTR {

    /**
     * Instantiates a new wparam.
     */
    public WPARAM() {
        this(0);
    }

    /**
     * Instantiates a new wparam.
     *
     * @param value the value
     */
    public WPARAM(long value) {
        super(value);
    }
} public static class HANDLE extends PointerType {

    private boolean immutable;

    public HANDLE() {
    }

    public HANDLE(Pointer p) {
        super();
        setPointer(p);
        immutable = true;
    }

    /**
     * Override to the appropriate object for INVALID_HANDLE_VALUE.
     *
     * @param nativeValue
     * @param context
     * @return
     */
    @Override
    public Object fromNative(Object nativeValue, FromNativeContext context) {
        Object o = super.fromNative(nativeValue, context);
        if (WinBase.INVALID_HANDLE_VALUE.equals(o)) {
            return WinBase.INVALID_HANDLE_VALUE;
        }
        return o;
    }

    @Override
    public void setPointer(Pointer p) {
        if (immutable) {
            throw new UnsupportedOperationException("immutable reference");
        }

        super.setPointer(p);
    }
}
import com.jpexs.javactivex.jna.BaseTSD.ULONG_PTR;
import com.jpexs.javactivex.jna.WinDef.HBRUSH;
import com.jpexs.javactivex.jna.WinDef.HCURSOR;
import com.jpexs.javactivex.jna.WinDef.HICON;
import com.jpexs.javactivex.jna.WinDef.HINSTANCE;
import com.jpexs.javactivex.jna.WinDef.HWND;
import com.jpexs.javactivex.jna.WinDef.LPARAM;
import com.jpexs.javactivex.jna.WinDef.LRESULT;
import com.jpexs.javactivex.jna.WinDef.WPARAM;
import com.jpexs.javactivex.jna.WinNT.HANDLE;
import com.sun.jna.Callback;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.Union;
import com.sun.jna.WString;
import com.sun.jna.win32.StdCallLibrary;
import java.util.Arrays;
import java.util.List;
    /**
     * Contains information about a simulated mouse event.
     */
    public static class MOUSEINPUT extends Structure {

        public static class ByReference extends MOUSEINPUT implements
                Structure.ByReference {

            public ByReference() {
            }

            public ByReference(Pointer memory) {
                super(memory);
            }
        }

        public MOUSEINPUT() {
        }

        public MOUSEINPUT(Pointer memory) {
            super(memory);
            read();
        }
        public WinDef.LONG dx;
        public WinDef.LONG dy;
        public WinDef.DWORD mouseData;
        public WinDef.DWORD dwFlags;
        public WinDef.DWORD time;
        public BaseTSD.ULONG_PTR dwExtraInfo;

        @Override
        protected List<String> getFieldOrder() {
            return Arrays.asList(new String[]{"dx", "dy", "mouseData",
                "dwFlags", "time", "dwExtraInfo"});
        }
    }

    /**
     * Contains the time of the last input.
     */
    public static class LASTINPUTINFO extends Structure {

        public int cbSize = size();
        // Tick count of when the last input event was received.
        public int dwTime;

        @Override
        protected List<String> getFieldOrder() {
            return Arrays.asList(new String[]{"cbSize", "dwTime"});
        }
    }

    /**
     * Contains window class information. It is used with the RegisterClassEx
     * and GetClassInfoEx functions.
     *
     * The WNDCLASSEX structure is similar to the WNDCLASS structure. There are
     * two differences. WNDCLASSEX includes the cbSize member, which specifies
     * the size of the structure, and the hIconSm member, which contains a
     * handle to a small icon associated with the window class.
     */
    public class WNDCLASSEX extends Structure {

        /**
         * The Class ByReference.
         */
        public static class ByReference extends WNDCLASSEX implements
                Structure.ByReference {
        }

        /**
         * Instantiates a new wndclassex.
         */
        public WNDCLASSEX() {
        }

        /**
         * Instantiates a new wndclassex.
         *
         * @param memory the memory
         */
        public WNDCLASSEX(Pointer memory) {
            super(memory);
            read();
        }
        /**
         * The cb size.
         */
        public int cbSize = this.size();
        /**
         * The style.
         */
        public int style;
        /**
         * The lpfn wnd proc.
         */
        public Callback lpfnWndProc;
        /**
         * The cb cls extra.
         */
        public int cbClsExtra;
        /**
         * The cb wnd extra.
         */
        public int cbWndExtra;
        /**
         * The h instance.
         */
        public HINSTANCE hInstance;
        /**
         * The h icon.
         */
        public HICON hIcon;
        /**
         * The h cursor.
         */
        public HCURSOR hCursor;
        /**
         * The hbr background.
         */
        public HBRUSH hbrBackground;