سؤال

If i make an invisible thread that will run in an infinite loop and which will consume any key event...

   something like,
   Keyevent ke;
   ke.consume();

if this is done for all keylistener interface methods, keypressed,released,typed. And if an invisible thread has all this code. If its converted to an exe...and exe is run.. Will it cause the psuedo keybord failure effect? Is it practically a potential virus?

هل كانت مفيدة؟

المحلول

Absolutely not. Java has not direct access to hardware, KeyEvents will work if and only if the component on which you apply the KeyListener is focused. If you want to disable the keyboard you have to use JNI/JNA/any other native interface.


However, this:

Keyevent ke;
ke.consume();

won't work, as ke is not initialized

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top