Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Looking for code examples to Hook into Keyboard

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Looking for code examples to Hook into Keyboard

    Hi All,

    1st post here and new to java other than an intro course at the local college (got a A-)

    I'm looking to implement a small windows or console app that would be launched from a windows start up folder that would effectively monitor keystokes and when a certain string is entered, a popup dialog message box would appear as a reminder to do something. In this case a bar code scanner is in use, that emulates keyboard entry, so when a particular code is scanned, a dialog appears.

    The machines are pretty much dedicated as bar code scanners, but if a user where to say open email and type in the proper sequence, I'd be ok with false positives. This program will monitor all keybpoard activity and wouldn't be limited to a particular application window that has focus.

    Does any one have knowledge of where I might find src code or a demo application that I could modify that provides some of this functionality.

    Btw: Win XP x86, Eclipse IDE.


    thanks
    Last edited by toddbailey; March 16th, 2012 at 05:15 PM.


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: Looking for code examples to Hook into Keyboard

    I'm looking to implement a small windows or console app that would be launched from a windows start up folder that would effectively monitor keystokes and when a certain string is entered...
    This would be - in effect, even if not in intent - spyware. As far as I know you can't do this in Java.

  3. The Following User Says Thank You to pbrockway2 For This Useful Post:

    copeg (March 16th, 2012)

  4. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Looking for code examples to Hook into Keyboard

    Maybe I need to speak with a hacker they try to collect account numbers, ssn, and other important information.
    But in my case I just need collect a string "abcdefghijklmnop" ect and if the sequence contains fghijkl then display a dialog.
    I suspect I'll need a buffer of some length a firsin first out buffer and for each keypress scan the buffer to see if it contains a match

    I'd like to code this in java, but I found code examples in C @ Global System Hooks in .NET - CodeProject®

    I'm pretty sure this can be done in java, since it's assumed to be just as powerful as C++ down to the OS level. But I can't prove the assumption.

Similar Threads

  1. Examples of Try Catch Exceptions
    By ch103 in forum Exceptions
    Replies: 11
    Last Post: February 8th, 2012, 09:22 PM
  2. XML using Sax simple examples
    By aueddonline in forum Java Theory & Questions
    Replies: 1
    Last Post: January 25th, 2012, 06:43 AM
  3. Program layout examples please
    By derekxec in forum Java Theory & Questions
    Replies: 1
    Last Post: July 2nd, 2011, 11:05 AM
  4. Serail Port Programming regarding phone line hook
    By maskey_dipesh in forum Java SE APIs
    Replies: 2
    Last Post: September 4th, 2009, 05:12 AM
  5. How to create a system wide mouse or keyboard hook?
    By Freaky Chris in forum Java Native Interface
    Replies: 17
    Last Post: June 17th, 2009, 01:06 PM