Click here to Skip to main content
15,898,729 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted
Updated 4-Mar-10 10:22am
v2

1 solution

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."
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900