How can I control my keyboard in C#?  
Author Message
simonii





PostPosted: .NET Base Class Library, How can I control my keyboard in C#? Top

I would like to write a program like in-screen keyboard. I face a problem that I do not know how to output a key to the system which like I am pressing the real keyboard.
I checked System.Windows.Forms.Keys but it seemed to be only handling the pressing event from user but not "pressing" the key by the program itself.
Thank you in advance.


.NET Development18  
 
 
Develop3r





PostPosted: .NET Base Class Library, How can I control my keyboard in C#? Top

SendKeys.SendWait("a");
SendKeys.SendWait("{TAB}");

etc

This'll send 'a', wait for it to be processed, and then send a tab, notice the way both are written.



 
 
simonii





PostPosted: .NET Base Class Library, How can I control my keyboard in C#? Top

thank you. But how can I find this method in msdn
I am new to programming. I always find difficulty to search such methodin msdn. I was trying to search for Window.Form.Keys. But it seemed to be no information for sending a key.

 
 
John230873





PostPosted: .NET Base Class Library, How can I control my keyboard in C#? Top

Find it difficuit myself and then half the time when I found something I still find it hard to understand the formatting, anyway the reason why you didn't find anything is becuase the Sendkeys is not part of the Forms.key class.

Normally I look for description words eg send keys or save file.