How to simulate key presses in C# [closed]

*爱你&永不变心* 提交于 2019-12-11 06:37:44

问题


How would you go about sending key commands or keypresses of particular keys in C#, specifically numbers.

For instance I would like to simulate typing "512" programatically.

Possibly Related: C# SendKeys.Send


回答1:


If you would use inputsimulator you could just do:

   var number = 2011;
   InputSimulator.SimulateTextEntry(number.ToString());



回答2:


An integer variable doesn't have a UI, so can't have a keypress.




回答3:


Events are for visual objects, not for variables



来源:https://stackoverflow.com/questions/4671695/how-to-simulate-key-presses-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!