简体   繁体   English

在C#WPF中控制鼠标

[英]Taking mouse control in C# WPF

I watnt o create a tutorial/guide inside in my application, creating a "demonstration". 我不想在我的应用程序内部创建一个教程/指南,创建一个“演示”。 For this purpose, I need to capture the mouse of the computer, and to be able to move it and click with it. 为此,我需要捕获计算机的鼠标,并能够移动它并单击它。

I want it to feel like if somebody else were there controling your computer. 我希望感觉好像有人在控制您的计算机。 This will be completed with a video of someone, to make you feel like this someone is doing it live in that moment. 这将以某人的视频完成,以使您感到当下有人正在做某事。

Thank you in advance!!! 先感谢您!!!

There isn't WPF solution. 没有WPF解决方案。 You have to use P/Invoke. 您必须使用P / Invoke。

To disable keyboard/mouse use BlockInput API (as far as I understand, you don't want user to break up your "demo"). 要禁用键盘/鼠标,请使用BlockInput API(据我了解,您不希望用户破坏您的“演示”)。
To simulate user input, use SendInput API. 要模拟用户输入,请使用SendInput API。
SendInput at pinvoke.net: http://www.pinvoke.net/default.aspx/user32.sendinput 在pinvoke.net上的SendInputhttp ://www.pinvoke.net/default.aspx/user32.sendinput

Another option is to use third-party simulators, like this . 另一种选择是使用像这样的第三方模拟器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM