xavatic
xavatic

Reputation: 185

JNativeHook home windows key

I've searched a lot but I didn't find any anwser to my issue.

I recently discovered JNativeHook and I use it to bring to the foreground an application window when I click on a key, even if the application has not the focus. Everything works good when I use keys like "a" or "f" but what I want is to use the "left-home" key of my keyboard.

The problem is when I do that, the windows menu appears but not my application which blinks in orange on the bottom launcher bar.

I think this is a normal behavior since the windows menu has a stronger priority than my application.

Do you think there is a possibility to override the default home button behavior? What I need is to bring to the front my application from elsewhere when I clicked on the left-home button.

Thanks for your replies,

Upvotes: 0

Views: 238

Answers (2)

user16028444
user16028444

Reputation:

I've had the same issue with CTRL and similar keys, you just have to run the program using an administrator command prompt (or with sudo-access on Linux)

It won't work if you're using Windows Terminal on Windows 10 though, you have to use CMD, also if you want your end-user to only use the program using administrative privileges, you'd have to add a manifest to your wrapper (You can do that in Launch4J afaik)

Upvotes: 0

Alex Barker
Alex Barker

Reputation: 4400

JNativeHook is getting a passive keyboard input from the operating system. If you press the Windows Key, the OS will bring up the menu if it receives that event. If you want to prevent that behavior, you must consume the event before the OS receives it. You can check the Wiki article for unsupported method of consuming events on Windows and OS X.

Upvotes: 0

Related Questions