Page 1 of 1

SendInput keys missing.

Posted: 8. Sep 2013, 05:21
by Light
I'm running VirtualBox 4.2.16 on Windows 7. I'm trying to use Dragonfly, a Python plug-in for Dragon NaturallySpeaking 12/NatLink. Unfortunately, this program uses SendInput to send key up-and-down events to the application in focus. It works as expected with Notepad, for example, but with a VirtualBox guest sometimes keystrokes will be missing. I have noticed this most often with the shift key.

By way of verification, I tried to replicate the behavior with AutoHotkey. I used the following script in my tests, but regardless of which line I uncommented the script did not produce input with VirtualBox. In the case of SendInput and SendEvent this script did work with Notepad. I used the AutoIt3 Window Spy utility that comes with AutoHotkey to determine the window class of the VirtualBox guest.

#IfWinActive ahk_class Notepad
space::
#IfWinActive ahk_class QWidget
space::
;SendInput if{space}(){enter}{{}{enter}
;SendPlay if{space}(){enter}{{}{enter}
;SendEvent if{space}(){enter}{{}{enter}
return

Is there a way to fix this behavior? I would like to verify that there is no error on my end before contacting the developers.

Thanks.

Re: SendInput keys missing.

Posted: 8. Sep 2013, 11:18
by mpack
The virtual guest simulated a keyboard at the hardware level and has its own keymapping, so I don't see how what you're doing could ever be made reliable. To be reliable you have to send scan codes, not letters like the user sees (e.g. with VBoxManage controlvm keyboardputscancode).

Re: SendInput keys missing.

Posted: 8. Sep 2013, 19:57
by Light
The Windows API call SendInput used by Dragonfly does send keycodes, yet keys are missed. My understanding was that some AutoHotkey functions also used SendInput. I know VirtualBox uses a host driver for Ethernet, does it also do this for keys?