Advertisement
Guest User

Untitled

a guest
Mar 14th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import windows, strutils, os
  2.  
  3. #type INPUT
  4. type MOUSEINPUT = object
  5. dx: LONG
  6. dy: LONG
  7. mouseData: DWORD
  8. dwFlags: DWORD
  9. time: DWORD
  10. dwExtraInfo: ptr culong
  11. type KEYBDINPUT = object
  12. wVk: WORD
  13. wScan: WORD
  14. dwFlags: DWORD
  15. time:DWORD
  16. dwExtraInfo:ptr culong
  17. type HARDWAREINPUT = object
  18. uMsg: DWORD
  19. wParamL: WORD
  20. wParamH: WORD
  21. type INPUT = object
  22. dwType: DWORD
  23. mi: MOUSEINPUT #0
  24. ki: KEYBDINPUT #1
  25. hi: HARDWAREINPUT #2
  26. type LPINPUT = ptr INPUT
  27.  
  28.  
  29. proc SendInput(nInputs: cuint, pInputs: LPINPUT, cbSize: int): WINUINT {.stdcall, dynLib: "user32", importc: "SendInput".}
  30. #proc SendInput(cInputs: WINUINT, pInputs: LPINPUT, cbSize: int): WINUINT{.stdcall, dynLib: "user32", importc: "SendInput".}
  31.  
  32. proc sendKey() =
  33. var ip: INPUT
  34. var extra: culong
  35.  
  36. extra = 0
  37.  
  38. sleep(5000)
  39.  
  40. ip.dwType = 1 #input keyboard
  41. ip.ki.wScan = 0
  42. ip.ki.time = 0
  43. ip.ki.dwExtraInfo = addr(extra)
  44.  
  45. ip.ki.wVk = 0x41
  46. ip.ki.dwFlags = 0
  47. discard SendInput(1, addr(ip), sizeof(INPUT))
  48.  
  49. ip.ki.dwFlags = 0x02
  50. discard SendInput(1, addr(ip), sizeof(INPUT))
  51.  
  52.  
  53. sendKey()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement