• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Capture global keypressed

Ranch Hand
Posts: 658
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,
I am in need to capture the global keystrokes. Even my java program is not is focus i want that the key pressed must be known to my java program. Like if my program is not in focus and I hit the F12 key, my java program window pop up.
I google this and found that I can use JNI or JNA for such purpose. JNA a bit easy than JNI.
Now I don't have any idea where to start. I didn't found any resource useful to my needs. Does someone have any link or resource where I can get a dummy code for such purposes or any useful tutorial ?
Posts: 26912
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's called a "keystroke logger". A program which does that can be used to keep track of what your kids are doing on the computer, or to capture the user's credit card number and send it to Russian hackers, or a variety of similar things. Anyway you're going to be using APIs for whatever operating system you're thinking of and calling them via JNA from some language other than Java. You should be able to find loads of keystroke logging code on the web but make sure that any code you download is legitimate and doesn't contain features that can be misused.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic