-1

I have a Form with a button . I want to press the Button in form instead of "W" key on keyboard and the "W" key become active and write in notepad "W".

that's very simply .

What's the Class or Method for this action?

Mehrdad
  • 15
  • 3
  • possible duplicate of [Global Keyhook in C#](http://stackoverflow.com/questions/15597890/global-keyhook-in-c-sharp) – DarkBee Jul 03 '15 at 20:55
  • you need to inject the data to other forms, i already show example how to do this here, http://stackoverflow.com/questions/31084208/can-i-send-answer-to-binary-file-with-batch-file/31084326#31084326 – Proxytype Jul 03 '15 at 20:56
  • 1
    "that's very simply ." Then why the need to ask others for help? – David Arno Jul 03 '15 at 21:28

1 Answers1

1

invoke "on screen keyboard" / avoid re-inventing the wheel where possible. the executable is osk.exe. In c#

Process.start("osk.exe")

this is equivalent to typing in osk.exe at commandprompt.

if you prefer not to use this for your application, on your form button click

System.Windows.Forms.SendKeys.Send("W"); 

should do the job

Krishna
  • 2,451
  • 1
  • 26
  • 31