Re: Identifying input from keyboard devices
From: Don Riesbeck Jr. (0207053pm-replyingroup_at_nerdlycrap.com)
Date: 02/07/05
- Next message: Claire: "TypeBuilder.DefinePInvokeMethod"
- Previous message: bleedledeep: "C# Very Odd Behavior - "failed to load resources from resource file""
- In reply to: james: "Re: Identifying input from keyboard devices"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 7 Feb 2005 16:19:17 -0500
I meant the barcodes themselves are outside of our control. (they are
supplied by vendors to our customers)
The application is a second generation of a product; we are set on the
machine, and have a couple USB scanners (we sell the whole thing.) We know
what scanners the current customers have, we sold them to them. Some of the
scanners support prefixing some don't we MUST support them all. The problem
is we have several different components which use barcodes and the code
currently used is very complicated. My hope was to have an object that just
monitored keyboard activity, and when it detected input from the barcode it
would simply set a property, and in the key pressed handler, we could just
have something like:
//Check for scan data
if (bcHook.isScan)
{
bctextBox.Text += e.KeyChar;
e.Handled = true;
return;
}
This would allow us to only worry about barcodes in the bctextBox field,
even if another textBox had focus.
I really only need to know if there was activity on the barcode scanner, I
don't need the actual data because it will come through the normal channels.
"james" <nospam@hypercon.net> wrote in message
news:u06Q%23xUDFHA.3732@TK2MSFTNGP14.phx.gbl...
> Yes, there is. You must write your own driver for the USB device driver.
> Then you can do anything you want. Or obtain the API from the vendor of
> that device. How do you know for sure it is USB? I thought you said that
> was outside your control? If the scanner IS inside your control, then you
> can add a PREFIX to the actual scanner hardware so that every bit of
scanned
> text is pre-pended with some special code. How do you always know it iwl
be
> a USB scanner and not a serial one? Or a Keyboard wedge? Again, I would
> ask what is your business case for needing to know? You will most likely
> need to re-design your app.
>
> JIM
>
> "Don Riesbeck Jr." <02070511am-reply-in-group@nerdlycrap.com> wrote in
> message news:ecDJbYUDFHA.3324@TK2MSFTNGP15.phx.gbl...
> > The Barcode scanner is not a "wedge" in the sense that it is inline with
> > the
> > keyboard. The keyboard is PS/2 and the BC scanner is USB.
> >
> > Our application must support input from the keyboard AND scanner. All
> > barcode data will be parsed by a library but keyboard input will just be
> > entered into the selected fields on the form.
> >
> > There must be a way to at least detect that the scanner input is
coming...
> >
> >
> >
> > "james" <nospam@hypercon.net> wrote in message
> > news:O1slxDUDFHA.2032@tk2msftngp13.phx.gbl...
> >> I guess you are out of luck then. Data passed in through a wedge comes
> > into
> >> the PC through the keyboard interupt and appears to the computer
exactly
> > as
> >> if it were typed. You should re-evaluate your reasons for why you need
> >> to
> >> know this, and try to find a more generic way to handle it. i.e. A
> > message
> >> box that states "The scanned data is incorrect" could simply state "The
> >> input data is incorrect" and your problem is solved.
> >>
> >> JIM
> >>
> >>
> >> "Don Riesbeck Jr." <02070511am-reply-in-group@nerdlycrap.com> wrote in
> >> message news:OhmB7%23TDFHA.3888@TK2MSFTNGP09.phx.gbl...
> >> >I wish, but unfortunatly the barcode format is configurable, and must
> >> > support third party formats that do not have prefixes.
> >> >
> >> > Thanks,
> >> > Don
> >> >
> >> > "james" <nospam@hypercon.net> wrote in message
> >> > news:ObNKMvTDFHA.3648@TK2MSFTNGP10.phx.gbl...
> >> >> Are you in control of the Barcodes? If so, you can add a special
code
> > to
> >> >> every encoded string for example, supppose the user can type
"PRODUCT
> > X"
> >> > or
> >> >> scan "PRODUCT X", the barcode could contain this instead "XXXProduct
> >> >> X"
> >> > and
> >> >> your code could always look for the first three starting characters
> >> >> and
> >> >> if
> >> >> they are XXX then you can assume they came form a scanner.
> >> >>
> >> >> JIM
> >> >>
> >> >>
> >> >> "Don Riesbeck Jr." <02070511am-reply-in-group@nerdlycrap.com> wrote
in
> >> >> message news:eBtyC8SDFHA.392@TK2MSFTNGP14.phx.gbl...
> >> >> > I'm working on an application (OEM) using C# that utilizes input
> >> >> > from
> > a
> >> >> > keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard
> >> > device,
> >> >> > and input from it is sent to the system as if it were a keyboard.
I
> >> >> > need
> >> >> > to
> >> >> > be able to identify input from the scanner and keyboard
> > independently.
> >> >> > I've
> >> >> > looked at DirectX.DirectInput, and using user32.dll to hook into
the
> >> >> > keyboard messages, but neither method seems to allow for
> > identification
> >> > of
> >> >> > the device sending the input. Inputs from either device are
received
> >> >> > and
> >> >> > there is not apparent difference.
> >> >> >
> >> >> > Is there a way for either method (DI, or hooks) to identify which
> >> > keyboard
> >> >> > device input is from? Or, is there another method that I
overlooked?
> >> >> >
> >> >> > (Note that the scanner cannot send pre-fixes, or be configured as
a
> > COM
> >> >> > device.)
> >> >> >
> >> >> > Thanks in advance!
> >> >> > Don Riesbeck Jr.
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
- Next message: Claire: "TypeBuilder.DefinePInvokeMethod"
- Previous message: bleedledeep: "C# Very Odd Behavior - "failed to load resources from resource file""
- In reply to: james: "Re: Identifying input from keyboard devices"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|