Class KEYBDINPUT

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class KEYBDINPUT extends Struct<KEYBDINPUT> implements NativeResource
Contains information about a simulated keyboard event.

Layout


 struct KEYBDINPUT {
     WORD wVk();
     WORD wScan();
     DWORD dwFlags();
     DWORD time();
     ULONG_PTR dwExtraInfo();
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • WVK

      public static final int WVK
      The struct member offsets.
    • WSCAN

      public static final int WSCAN
      The struct member offsets.
    • DWFLAGS

      public static final int DWFLAGS
      The struct member offsets.
    • TIME

      public static final int TIME
      The struct member offsets.
    • DWEXTRAINFO

      public static final int DWEXTRAINFO
      The struct member offsets.
  • Constructor Details

    • KEYBDINPUT

      public KEYBDINPUT(ByteBuffer container)
      Creates a KEYBDINPUT instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<KEYBDINPUT>
    • wVk

      public short wVk()
      A virtual-key code.

      The code must be a value in the range 1 to 254. If the dwFlags member specifies User32.KEYEVENTF_UNICODE, wVk must be 0.

    • wScan

      public short wScan()
      A hardware scan code for the key.

      If dwFlags specifies User32.KEYEVENTF_UNICODE, wScan specifies a Unicode character which is to be sent to the foreground application.

    • dwFlags

      public int dwFlags()
    • time

      public int time()
      the time stamp for the event, in milliseconds. If this parameter is zero, the system will provide its own time stamp.
    • dwExtraInfo

      public long dwExtraInfo()
      an additional value associated with the keystroke. Use the User32.GetMessageExtraInfo() function to obtain this information.
    • wVk

      public KEYBDINPUT wVk(short value)
      Sets the specified value to the wVk() field.
    • wScan

      public KEYBDINPUT wScan(short value)
      Sets the specified value to the wScan() field.
    • dwFlags

      public KEYBDINPUT dwFlags(int value)
      Sets the specified value to the dwFlags() field.
    • time

      public KEYBDINPUT time(int value)
      Sets the specified value to the time() field.
    • dwExtraInfo

      public KEYBDINPUT dwExtraInfo(long value)
      Sets the specified value to the dwExtraInfo() field.
    • set

      public KEYBDINPUT set(short wVk, short wScan, int dwFlags, int time, long dwExtraInfo)
      Initializes this struct with the specified values.
    • set

      public KEYBDINPUT set(KEYBDINPUT src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static KEYBDINPUT malloc()
      Returns a new KEYBDINPUT instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static KEYBDINPUT calloc()
      Returns a new KEYBDINPUT instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static KEYBDINPUT create()
      Returns a new KEYBDINPUT instance allocated with BufferUtils.
    • create

      public static KEYBDINPUT create(long address)
      Returns a new KEYBDINPUT instance for the specified memory address.
    • createSafe

      @Nullable public static KEYBDINPUT createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static KEYBDINPUT.Buffer malloc(int capacity)
      Returns a new KEYBDINPUT.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static KEYBDINPUT.Buffer calloc(int capacity)
      Returns a new KEYBDINPUT.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static KEYBDINPUT.Buffer create(int capacity)
      Returns a new KEYBDINPUT.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static KEYBDINPUT.Buffer create(long address, int capacity)
      Create a KEYBDINPUT.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      @Nullable public static KEYBDINPUT.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • mallocStack

      @Deprecated public static KEYBDINPUT mallocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static KEYBDINPUT callocStack()
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static KEYBDINPUT mallocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(MemoryStack) instead.
    • callocStack

      @Deprecated public static KEYBDINPUT callocStack(MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(MemoryStack) instead.
    • mallocStack

      @Deprecated public static KEYBDINPUT.Buffer mallocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static KEYBDINPUT.Buffer callocStack(int capacity)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • mallocStack

      @Deprecated public static KEYBDINPUT.Buffer mallocStack(int capacity, MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use malloc(int, MemoryStack) instead.
    • callocStack

      @Deprecated public static KEYBDINPUT.Buffer callocStack(int capacity, MemoryStack stack)
      Deprecated.
      Deprecated for removal in 3.4.0. Use calloc(int, MemoryStack) instead.
    • malloc

      public static KEYBDINPUT malloc(MemoryStack stack)
      Returns a new KEYBDINPUT instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static KEYBDINPUT calloc(MemoryStack stack)
      Returns a new KEYBDINPUT instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static KEYBDINPUT.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new KEYBDINPUT.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static KEYBDINPUT.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new KEYBDINPUT.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nwVk

      public static short nwVk(long struct)
      Unsafe version of wVk().
    • nwScan

      public static short nwScan(long struct)
      Unsafe version of wScan().
    • ndwFlags

      public static int ndwFlags(long struct)
      Unsafe version of dwFlags().
    • ntime

      public static int ntime(long struct)
      Unsafe version of time().
    • ndwExtraInfo

      public static long ndwExtraInfo(long struct)
      Unsafe version of dwExtraInfo().
    • nwVk

      public static void nwVk(long struct, short value)
      Unsafe version of wVk.
    • nwScan

      public static void nwScan(long struct, short value)
      Unsafe version of wScan.
    • ndwFlags

      public static void ndwFlags(long struct, int value)
      Unsafe version of dwFlags.
    • ntime

      public static void ntime(long struct, int value)
      Unsafe version of time.
    • ndwExtraInfo

      public static void ndwExtraInfo(long struct, long value)
      Unsafe version of dwExtraInfo.