views:

46

answers:

1

Hi everybody!

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?

Thanks in advance!

+1  A: 

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.

tommieb75
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!!!
youllknow
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).
youllknow
@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?
tommieb75
Yes, I have tried it. I thought I may work with DirectInput because it may me more hardware oriented.
youllknow