windows 以编程方式模拟操纵杆

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1003657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:38:41  来源:igfitidea点击:

Emulating joystick programmatically

windowsdevice-driverwdk

提问by itsfrosty

I want to emulate a joystick using keypresses and/or mouse input. So other programs/games will think that user is using a joystick while he is using a mouse.

我想使用按键和/或鼠标输入来模拟操纵杆。所以其他程序/游戏会认为用户在使用鼠标时正在使用操纵杆。

So the program will install kindof a driver for fake usb or fake an existing joystick.

因此,该程序将为假 USB 或假现有操纵杆安装某种驱动程序。

There is an existing program called PPJoy which does the same thing but sadly its closed source and needs the user to install it standalone and do the configuration steps.

有一个名为 PPJoy 的现有程序,它做同样的事情,但遗憾的是它是封闭的源代码,需要用户单独安装它并执行配置步骤。

Found this: http://www.microsoft.com/whdc/archive/hidgame.mspx

发现这个:http: //www.microsoft.com/whdc/archive/hidgame.mspx

but not able to make much sense out of it. Some high level pointers required so that I can then research on my own instead of blindly knocking all doors :)

但无法从中获得多大意义。需要一些高级指针,以便我可以自己研究,而不是盲目地敲所有门:)

edit: i am trying to control a third party program which supports only joystick

编辑:我正在尝试控制仅支持操纵杆的第三方程序

采纳答案by Dale

see my answer for a previous question that is really similar to yours.

请参阅我对上一个问题的回答,该问题与您的问题非常相似。

Writing a windows driver for an emulated input device

为模拟输入设备编写 Windows 驱动程序

Obviously it depends on what type of joystick input you are trying to emulate. Writing a custom driver is really something you want to avoid as much as you can. You may not need to do it at all.

显然,这取决于您要模拟的操纵杆输入类型。编写自定义驱动程序确实是您想尽可能避免的事情。您可能根本不需要这样做。

回答by Louis Davis

Your best bet would be to modify the sample VHIDMINI - Sample for Virtual HID devicefrom the Windows DDK. You could modify this sample driver to emulate a joystick HID device and then send out joystick HID reports from the driver.

最好的办法是修改示例VHIDMINI -来自 Windows DDK 的虚拟 HID 设备示例。您可以修改此示例驱动程序以模拟操纵杆 HID 设备,然后从驱动程序发送操纵杆 HID 报告。