Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
318 views
in Technique[技术] by (71.8m points)

how to disable keyboard hotkey in java swing

i want to disable keyboard hotkey such as alt ctrl alt + f4 ctrl + alt + dlt in my netbeans project so that no one can open anything while my application is on

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are asking for a way within Netbeans to disable global keyboard hotkeys for Windows. This simply isn't possible, as both of your key combinations are registered and intercepted at the kernel level way before Netbeans or any other Windows application even notices them.

There are ways to disable these kinds of hotkeys within Windows, but this can't be done programmatically with Java. Instead try Googling "Disable hotkeys Windows X" or "Disable ctrl alt del Windows X.

An answer on SuperUser suggests a possible registry fix for disabling ctrl+alt+del on Windows 7. The suggested registry edit is:

[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionImage File Execution Options askmgr.exe]

"Debugger"="Hotkey Disabled"

There are other ways of disabling certain hotkeys depending on what version of Windows you are running and what kind of access you have to the computer. Without admin rights, any solution will be difficult.

This could also be done problematically using a lower level language such as C++ or even C#, but I don't think any of the Java libraries can intercept and block low level keyboard events.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...