3

I'm logged into a virtual machine using vmware workstation 6.5-7.0.1 or vmware player 3.0.0. I'm working inside the virtual machine. Then I press a key (for example the Delete-Key, but it should work with every key) inside the virtual machine.

I want to recognize the "key-press-event" in my C# application which is running outside of the virtual machine.

Can you think of any way to do this?

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
raisyn
  • 4,514
  • 9
  • 36
  • 55

1 Answers1

1

I am not 100% sure if you can actually hook into the VM unless there's an SDK that you can download to intercept it, remember the VMWare is simulating a separate machine, but a logical one alright...The downloads are available here from VMWare.

I can only guess (I use Virtualbox myself), that a Virtual Machine (VMWare/VirtualBox) seizes control of the hooks for the keyboard I would imagine, the host system would not see them...but it would be interesting to try out... I have provided links to CodeProject for keyboard hooks...

Find the one that would suit you in terms of ease-of-use, and try hook in the keyboard, run the VMWare, with your C# application running and see if it picks up any keys within the virtual machine... I would be interested to know...

And oh yeah, +1 from me for good question and welcome to SO! :)

Hope this helps, Best regards, Tom.

t0mm13b
  • 34,087
  • 8
  • 78
  • 110
  • I have already found 3 of the links you provided, before I asked this questition here. So I'm now going over "EasyHook". The other 3 want work for my specific situation. THANK FOR YOUR HELP!!! – raisyn Feb 14 '10 at 10:44
  • EasyHook isn't very useful for me. I've found a "solution" by checking if the state of capslock, numlock or scolllock has changed... this is the only thing, I found out, which works the virtual machine. Even DirectX DirectInput doesn't work (very strange). – raisyn Feb 14 '10 at 20:53
  • @Youllknow: DirectX is more for the graphics and games, I am surprised you could only obtain the LED's for the caps/num/scroll lock and nothing else...I guess, since VMWare has the focus and active window, the VMWare's keyboard hook takes precedence, when the VMWare window is not active/not focused, you cannot obtain the keyboard data...that is my guess...have you tried hooking the keyboard PRIOR to running VMWare? – t0mm13b Feb 14 '10 at 21:20
  • Yes, I have tried it. I thought I may work with DirectInput because it may me more hardware oriented. – raisyn Feb 15 '10 at 09:06