Reputation: 2842
I am doing some Client & sever programs in that I will bring the client screen to my server application... it's same like VNC.. here i have done all move moving as well as mouse clicking opereations by help of remoting concept here keyboard operation is pending in that i could send keybord values to corresponding focused controls... now i want to make some short cut key operations like Ctrl+A ,Ctrl+v etc..... i want to done this by help of KeyData.... how can i do this operation ... here i can send a key to client machne like A ,control A ,shift etc... that operation should occue in client machine this is i want.
Upvotes: 0
Views: 2420
Reputation:
i was actually trying to implement the same..i was wondering if it would be possible for u to give me some directions as to how to implement the keyboard part in a project that appears to simulate remote desktop...even just the code would help a lot!!
Upvotes: 0
Reputation: 1760
You can call the Win32 api to generate key and mouse events or use the SendKeys API. Each language in .Net should have access to the underlying win32 api.
There is no direct way from C# but I found this at msdn. It shows how to use SendKeys to automate key presses. You will have to identify the target window, find the key codes you want and generate a keybd_event.
VK_KEY codes - VK_CONTROL (0x11)
How to use keybd_event Function
Have you done the events in the right order?
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYDOWN, 0);//press ctrl
keybd_event(0x41, 0, KEYEVENTF_KEYDOWN, 0);//hex 'A'
keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);//hex 'A'
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); //release ctrl
Upvotes: 2