Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. const int INPUT_MOUSE = 0;
  2. const int INPUT_KEYBOARD = 1;
  3. const int INPUT_HARDWARE = 2;
  4. const uint KEYEVENTF_EXTENDEDKEY = 0x0001;
  5. const uint KEYEVENTF_KEYUP = 0x0002;
  6. const uint KEYEVENTF_UNICODE = 0x0004;
  7. const uint KEYEVENTF_SCANCODE = 0x0008;
  8.  
  9. struct INPUT
  10. {
  11. public int type;
  12. public InputUnion u;
  13. }
  14.  
  15. [StructLayout(LayoutKind.Explicit)]
  16. struct InputUnion
  17. {
  18. [FieldOffset(0)]
  19. public MOUSEINPUT mi;
  20. [FieldOffset(0)]
  21. public KEYBDINPUT ki;
  22. [FieldOffset(0)]
  23. public HARDWAREINPUT hi;
  24. }
  25.  
  26. [StructLayout(LayoutKind.Sequential)]
  27. struct MOUSEINPUT
  28. {
  29. public int dx;
  30. public int dy;
  31. public uint mouseData;
  32. public uint dwFlags;
  33. public uint time;
  34. public IntPtr dwExtraInfo;
  35. }
  36.  
  37. [StructLayout(LayoutKind.Sequential)]
  38. struct KEYBDINPUT
  39. {
  40. /*Virtual Key code. Must be from 1-254. If the dwFlags member specifies KEYEVENTF_UNICODE, wVk must be 0.*/
  41. public ushort wVk;
  42. /*A hardware scan code for the key. If dwFlags specifies KEYEVENTF_UNICODE, wScan specifies a Unicode character which is to be sent to the foreground application.*/
  43. public ushort wScan;
  44. /*Specifies various aspects of a keystroke. See the KEYEVENTF_ constants for more information.*/
  45. public uint dwFlags;
  46. /*The time stamp for the event, in milliseconds. If this parameter is zero, the system will provide its own time stamp.*/
  47. public uint time;
  48. /*An additional value associated with the keystroke. Use the GetMessageExtraInfo function to obtain this information.*/
  49. public IntPtr dwExtraInfo;
  50. }
  51.  
  52. [StructLayout(LayoutKind.Sequential)]
  53. struct HARDWAREINPUT
  54. {
  55. public uint uMsg;
  56. public ushort wParamL;
  57. public ushort wParamH;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement