Send Special key to system?

Just starting out? Need help? Post your questions and find answers here.
arma
User
User
Posts: 67
Joined: Sun Jul 24, 2016 11:54 pm

Send Special key to system?

Post by arma »

Is there any way or command to send special key to system? Cross Platform?

for example i want to send Control + L
or Scroll Lock
or Numlock
etc...

Thank You!
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Send Special key to system?

Post by infratec »

Windows only:

Code: Select all

Dim SendInputData.INPUT(3)


; press CONTROL
SendInputData(0)\type = #INPUT_KEYBOARD
SendInputData(0)\ki\wVK = #VK_CONTROL

; press l
SendInputData(1)\type = #INPUT_KEYBOARD
SendInputData(1)\ki\wVK = #VK_L

; release l
SendInputData(2)\type = #INPUT_KEYBOARD
SendInputData(2)\ki\dwFlags = #KEYEVENTF_KEYUP
SendInputData(2)\ki\wVK = #VK_L

; release CONTROL
SendInputData(3)\type = #INPUT_KEYBOARD
SendInputData(3)\ki\dwFlags = #KEYEVENTF_KEYUP
SendInputData(3)\ki\wVK = #VK_CONTROL



SendInput_(1, @SendInputData(0), SizeOf(INPUT))
Delay(30)

SendInput_(1, @SendInputData(1), SizeOf(INPUT))
Delay(200)

SendInput_(1, @SendInputData(2), SizeOf(INPUT))
Delay(30)

SendInput_(1, @SendInputData(3), SizeOf(INPUT))
Delay(30)
Bernd
Post Reply