游戏运行下的鼠标控制 [英] Mouse control under game running

查看:79
本文介绍了游戏运行下的鼠标控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!


我正在开发一个允许定义鼠标移动的应用程序。当游戏运行并按下鼠标左键时,必须执行这些动作。该应用程序运行良好。它允许用户进行自定义动作
定义,当用户按下左按钮时,即使游戏以全屏模式运行,鼠标光标也会开始正确移动。但是我发现了几个阻止这些动作被执行的游戏。当这些游戏中的任何一个运行
并且按下鼠标的左键时,我的应用程序检测到该信号,执行与用户先前定义的运动相关的所有计算,并使用以下方法将计算的位置设置为鼠标声明:

 System.Windows.Forms.Cursor.Position = new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X + xChange,System .Windows.Forms.Cursor.Position.Y  -  yChange); 

但是鼠标永远不会更新它的位置。我想强调的是,在很多游戏中它都运行良好,即使在全屏模式下也是如此。但我需要知道为什么还有其他游戏阻止了所需的行为。提示任何人?

解决方案

@determinista,


但是我发现了几个阻止动作被执行的游戏。


你能具体一下吗?您有样本可以重现此问题吗?你的意思是你正在把你的项目挂钩到一些游戏过程中它会在游戏运行时检测到按键事件吗?


祝你好运,


巴里


Hi everyone!

I am developing an application which allows defining mouse movements. These movements must be executed when a game is running and the left button of the mouse is pressed. The application functions well. It allows the user to make the custom movements definitions and when the user presses the left button, the mouse cursor starts moving correctly, even when a game is running in full-screen mode. But I have found several games which prevent the movements to be executed. When any of these games are running and the left button of the mouse is pressed, my application detects that signal, executes all the calculations related to the movement previously defined by the user and sets calculated positions to the mouse using the following statement:

System.Windows.Forms.Cursor.Position = new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X + xChange, System.Windows.Forms.Cursor.Position.Y - yChange);

But the mouse never updates its position. I would like to stress that in many games it works well, even in full-screen mode. But I need to know why there are other games that prevent the desired behavior. A hint anybody?

解决方案

@determinista,

But I have found several games which prevent the movements to be executed.

Can you be specific about this? Do you have a sample to reproduce this issue? Do you mean you are hooking your project to some game process and it will detect the keypress event when game running?

Best regards,

Barry


这篇关于游戏运行下的鼠标控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆