Hi,
I've a magnetic stripe reader connected via usb to my pc. When I slide
my badge into the reader it write the content of the magnetic card in
whatever editor is focused in that moment. I need to intercept this
stream. Another info, my computer see the card reader like a keyboard.
I've another question too. Is it possible to wrtite a listener that
focus on my application when I slide the badge into the reader?
Thanks in advance Andrea
Ian Wilson - 17 Oct 2006 17:20 GMT
> Hi,
> I've a magnetic stripe reader connected via usb to my pc.
I assume Windows.
> When I slide
> my badge into the reader it write the content of the magnetic card in
> whatever editor is focused in that moment. I need to intercept this
> stream. Another info, my computer see the card reader like a keyboard.
Commonly called a keyboard-wedge interface.
> I've another question too.
Was there an earlier question?
> Is it possible to wrtite a listener that
> focus on my application when I slide the badge into the reader?
I find it hard to work out what your mean. If you want the use of the
card-reader to change which application has focus then you are probably
out of luck with your current card-reader.
If your card has some unique characters at the start then you might be
able to find a Windows "hotkey" application which could be configured to
launch your application.
I think you'd need a card reader with a different sort of interface.
Then you could probably write an application that listens to that interface.
Java wouldn't be my first choice for this sort of thing, but maybe
that's because I'm still a relative novice at it.
Rodrigo Zechin - 17 Oct 2006 19:05 GMT
On Oct 17, 7:53 am, andrea.po...@gmail.com wrote:
> Hi,
> I've a magnetic stripe reader connected via usb to my pc. When I slide
[quoted text clipped - 4 lines]
> focus on my application when I slide the badge into the reader?
> Thanks in advance Andrea
If you have focus on your application, you can set a global
KeyEventDispatcher to handle this. (Doing this you avoid to implement a
keyboard listener on every frame, dialog, etc)
See:
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new
MyDispatcher());
If you don't have focus, you will need to implement that using JNI...
RZR