How do I set the position of the mouse cursor from a Console app in C#?

后端 未结 4 784
北荒
北荒 2021-01-05 02:38

I\'ve found many articles on how to set the mouse position in a C# windows forms project - I want to do this in a console application. How can I set the abs

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-05 03:28

    Inside your console application, add a reference to System.Windows.Forms.dll and use the other techniques you've read about. The choice of console vs windows exe only impacts the PE header (and maybe the default code template, but you can hack that trivially); you can still use the full framework in a console exe.

    The mouse you want to control is in windows, not the console.

提交回复
热议问题