我的操纵杆问题 [英] My Joystick Problem

查看:98
本文介绍了我的操纵杆问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个操纵杆,我编写了一个程序来检测何时按下了操纵杆上的按钮并模拟了鼠标单击.当我运行我的应用程序时,一切正常,但是当我将其最小化到系统托盘时(this.Visible = false; notifyIcon1.Visible = true; 我的应用程序中有一个通知图标),当我按下按钮时,它不再响应(从操纵杆).

Hello, I have a joystick and I made a program to detect when a button from the joystick is pressed and simulate a mouse click. When I run my application everything works fine, but when I minimize it to system tray (this.Visible = false; notifyIcon1.Visible = true; I have a notify Icon in my app) it doesn''t respond anymore when I press a button (from the joystick). What should I do to get respond when it''s minimized?

推荐答案

您将不得不做一个全局钩子.当最小化"表单时,它不再具有焦点.

尝试SetWindowsHookEx并使用任何表示您的操纵杆按钮消息的消息.可以在
找到一个示例
如何在Visual C#.NET中设置Windows挂钩 [
You''re going to have to do a global hook. When you "minimize" the form, it no longer has the focus.

Try SetWindowsHookEx with whatever message represents your joystick button message is. An example can be found at

How to set a Windows hook in Visual C# .NET[^]

But from what I can tell, global hooks generally are not supported by .Net. From the above webpage:

"Except for the WH_KEYBOARD_LL low-level hook and the WH_MOUSE_LL low-level hook, you cannot implement global hooks in the Microsoft .NET Framework."


这篇关于我的操纵杆问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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