Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import windows, strutils, os
- #type INPUT
- type MOUSEINPUT = object
- dx: LONG
- dy: LONG
- mouseData: DWORD
- dwFlags: DWORD
- time: DWORD
- dwExtraInfo: ptr culong
- type KEYBDINPUT = object
- wVk: WORD
- wScan: WORD
- dwFlags: DWORD
- time:DWORD
- dwExtraInfo:ptr culong
- type HARDWAREINPUT = object
- uMsg: DWORD
- wParamL: WORD
- wParamH: WORD
- type INPUT = object
- dwType: DWORD
- mi: MOUSEINPUT #0
- ki: KEYBDINPUT #1
- hi: HARDWAREINPUT #2
- type LPINPUT = ptr INPUT
- proc SendInput(nInputs: cuint, pInputs: LPINPUT, cbSize: int): WINUINT {.stdcall, dynLib: "user32", importc: "SendInput".}
- #proc SendInput(cInputs: WINUINT, pInputs: LPINPUT, cbSize: int): WINUINT{.stdcall, dynLib: "user32", importc: "SendInput".}
- proc sendKey() =
- var ip: INPUT
- var extra: culong
- extra = 0
- sleep(5000)
- ip.dwType = 1 #input keyboard
- ip.ki.wScan = 0
- ip.ki.time = 0
- ip.ki.dwExtraInfo = addr(extra)
- ip.ki.wVk = 0x41
- ip.ki.dwFlags = 0
- discard SendInput(1, addr(ip), sizeof(INPUT))
- ip.ki.dwFlags = 0x02
- discard SendInput(1, addr(ip), sizeof(INPUT))
- sendKey()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement