I write a little client using WinForms, C#, AxMsTscNotSafeForScripting tool, and I need to send Win+R on the VM(yes, I know, there's a way to launch app remotely without RunDialog, but I need to).
I quickly found nice lib named InputSimulator
, it simulates everything correctly on my main machine, but no effect on VM.
Actually, it can send the whole string
into notepad, but when it deals with VirtualKeyCodes, nothing happens.
After drilling Google a bit deeper I found usage of WindowsAPI.SendInput
with methods
void PressKey(char ch, bool press)
void KeyDown(ushort scanCode)
void KeyUp(ushort scanCode)
.
PressKey
is working with VM, but KeyDown
and KeyUp
, which I need, are incorrect. For example, 81 is ScanCode for "Q", but it prints "." in notepad, 82 is for "R", but I get "0" and I get nothing at all with 91, that's for Windows key.
If I press key with a keyboard, everything works, so problem isn't in KeyPreview, EnableWindowsKey, etc settings
Both systems are Win7, Oracle VM VirtualBox.
Even if my way is hopeless, what are another ways to send Win+R programmly to VM? Help will be greatly appreciated!