keybd_event superseded
Opened this issue · 1 comments
ls5302 commented
I note from https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-keybd_event that the keybd_event
function, which is used to implement send_key
functionality, has been superseded by SendInput
.
I have monkey patched the Win32::Windows class to test, and the change appears straight forward:
def kb_input(wVk, flag)
input = Array.new(7, 0)
input[0] = 0x1
input[1] = wVk
input[2] = flag
input.pack "L*"
end
def send_input(*inputs)
Functions.send_input inputs.size, inputs.join, inputs[0].size
end
def press_key(key)
send_input kb_input(key, 0)
key
end
def release_key(key)
send_input kb_input(key, Constants::KEYEVENTF_KEYUP)
key
end
Is this of any use to you?
jarmo commented
Hello! Thanks for the information.
Can you say if that solves any problem with RAutomation? I can imagine that it might create a problem where RAutomation might stop working on older Windows versions due to this change.