Hi all



I have made a application that scans barcode. The barcode scanner is connect
to the PC via one of the USB ports.



The technique that I use is hidden textbox that constantly has the focus to
process the input on the keydown event. This works fine.



It goes wrong when the user clicks for instance on one of the listboxes.
Before start scanning the user has to click on a button on the toolbar first
to set the focus back on the textbox. In some other cases I can do that in
code.



My customer has problems to click on the button first to start scanning
again. My question is if there is a other method that constantly receives
input from a barcode scanner and process it. If have tried to monitor the
USB port but I can't figure it out how this works. What also interest me is
how other programs do this.



Hopefully someone can help me with suggestions, sample or websites with
information about this topic.



Thanks in advance.

Tim





O yes, I posted this message in two newsgroups because I develop in VB6
and/or .Net so don't' shout at me please.

Re: Scanning barcodes (urgent) by kimiraikkonen

kimiraikkonen
Thu Mar 13 04:55:41 CDT 2008

On Mar 13, 11:25=A0am, "tim" <tni...@hotmail.com> wrote:
> Hi all
>
> I have made a application that scans barcode. The barcode scanner is conne=
ct
> to the PC via one of the USB ports.
>
> The technique that I use is hidden textbox that constantly has the focus t=
o
> process the input on the keydown event. This works fine.
>
> It goes wrong when the user clicks for instance on one of the listboxes.
> Before start scanning the user has to click on a button on the toolbar fir=
st
> to set the focus back on the textbox. In some other cases I can do that in=

> code.
>
> My customer has problems to click on the button first to start scanning
> again. My question is if there is a other method that constantly receives
> input from a barcode scanner and process it. If have tried to monitor the
> USB port but I can't figure it out how this works. What also interest me i=
s
> how other programs do this.
>
> Hopefully someone can help me with suggestions, sample or websites with
> information about this topic.
>
> Thanks in advance.
>
> Tim
>
> O yes, I posted this message in two newsgroups because I develop in VB6
> and/or .Net so don't' shout at me please.

Hi,
You can assign a timer control to the barcode scanning form on load,
then set a reasonable interval that queries your code will scan for
barcodes, then put the barcode scanning code in that timer1.tick
event. If you need any if-then statements set them also.

Also look at control (your textbox).lostfocus event to determine what
message or action you need to when your control loses focus. If it
doesn't work look for "enter" and "leave" events.

Hope this helps.

Re: Scanning barcodes (urgent) by usenet

usenet
Thu Mar 13 04:57:41 CDT 2008

Hi Tim

tim wrote:
> I have made a application that scans barcode. The barcode scanner is connect
> to the PC via one of the USB ports.
> The technique that I use is hidden textbox that constantly has the focus to
> process the input on the keydown event. This works fine.

you probably don't need to fiddle around with programming of the
USB-port. Just set the key preview event of the form to true and monitor
the keydown event of the form instead of using a hidden textbox. In this
case, you just need to make sure that the form has focus when scanning a
code.

If those barcodes have a checksum (like EAN8 or EAN13), I suggest you
keep the last xx chars/numbers in a variable and do a checksum
calculation on that. If its valid, you just received a full barcode.


Regards,

Mathias Wuehrmann

Re: Scanning barcodes (urgent) by tim

tim
Thu Mar 13 06:20:34 CDT 2008

Hi Mathias,

I will look in to that. Maybe that will solve the most of my problems.

Tim

"Mathias Wührmann" <usenet@flexact.de> schreef in bericht
news:ekambDPhIHA.748@TK2MSFTNGP04.phx.gbl...
> Hi Tim
>
> tim wrote:
>> I have made a application that scans barcode. The barcode scanner is
>> connect to the PC via one of the USB ports.
>> The technique that I use is hidden textbox that constantly has the focus
>> to process the input on the keydown event. This works fine.
>
> you probably don't need to fiddle around with programming of the USB-port.
> Just set the key preview event of the form to true and monitor the keydown
> event of the form instead of using a hidden textbox. In this case, you
> just need to make sure that the form has focus when scanning a code.
>
> If those barcodes have a checksum (like EAN8 or EAN13), I suggest you keep
> the last xx chars/numbers in a variable and do a checksum calculation on
> that. If its valid, you just received a full barcode.
>
>
> Regards,
>
> Mathias Wuehrmann



Re: Scanning barcodes (urgent) by tim

tim
Thu Mar 13 06:21:59 CDT 2008

I use lost and got focus to trigger the state of my toolbar buttons.

I don't think that a timer will help. Scanning can take place at any time.

"kimiraikkonen" <kimiraikkonen85@gmail.com> schreef in bericht
news:5cdaea2d-9909-495c-a3d2-b4aed2e05cd2@i12g2000prf.googlegroups.com...
On Mar 13, 11:25 am, "tim" <tni...@hotmail.com> wrote:
> Hi all
>
> I have made a application that scans barcode. The barcode scanner is
> connect
> to the PC via one of the USB ports.
>
> The technique that I use is hidden textbox that constantly has the focus
> to
> process the input on the keydown event. This works fine.
>
> It goes wrong when the user clicks for instance on one of the listboxes.
> Before start scanning the user has to click on a button on the toolbar
> first
> to set the focus back on the textbox. In some other cases I can do that in
> code.
>
> My customer has problems to click on the button first to start scanning
> again. My question is if there is a other method that constantly receives
> input from a barcode scanner and process it. If have tried to monitor the
> USB port but I can't figure it out how this works. What also interest me
> is
> how other programs do this.
>
> Hopefully someone can help me with suggestions, sample or websites with
> information about this topic.
>
> Thanks in advance.
>
> Tim
>
> O yes, I posted this message in two newsgroups because I develop in VB6
> and/or .Net so don't' shout at me please.

Hi,
You can assign a timer control to the barcode scanning form on load,
then set a reasonable interval that queries your code will scan for
barcodes, then put the barcode scanning code in that timer1.tick
event. If you need any if-then statements set them also.

Also look at control (your textbox).lostfocus event to determine what
message or action you need to when your control loses focus. If it
doesn't work look for "enter" and "leave" events.

Hope this helps.



Re: Scanning barcodes (urgent) by Dick

Dick
Thu Mar 13 14:39:37 CDT 2008

Well, perhap you can get it to work. However, IMO, industrial-strength
applications should NOT use keyboad (HID) scanners. For a few dollars more,
one with a serial interface will work flawlessly, and won't require any
coding tricks (none of which I've been able to get to work reliably).

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.



Re: Scanning barcodes (urgent) by GS

GS
Fri Mar 14 12:34:11 CDT 2008

so 10 millisecond or 5 ms is enough for real time? just try and see unless
you find a better alternative

"tim" <tnieuw@hotmail.com> wrote in message
news:47d90ebe$0$14347$e4fe514c@news.xs4all.nl...
> I use lost and got focus to trigger the state of my toolbar buttons.
>
> I don't think that a timer will help. Scanning can take place at any time.
>
> "kimiraikkonen" <kimiraikkonen85@gmail.com> schreef in bericht
> news:5cdaea2d-9909-495c-a3d2-b4aed2e05cd2@i12g2000prf.googlegroups.com...
> On Mar 13, 11:25 am, "tim" <tni...@hotmail.com> wrote:
> > Hi all
> >
> > I have made a application that scans barcode. The barcode scanner is
> > connect
> > to the PC via one of the USB ports.
> >
> > The technique that I use is hidden textbox that constantly has the focus
> > to
> > process the input on the keydown event. This works fine.
> >
> > It goes wrong when the user clicks for instance on one of the listboxes.
> > Before start scanning the user has to click on a button on the toolbar
> > first
> > to set the focus back on the textbox. In some other cases I can do that
in
> > code.
> >
> > My customer has problems to click on the button first to start scanning
> > again. My question is if there is a other method that constantly
receives
> > input from a barcode scanner and process it. If have tried to monitor
the
> > USB port but I can't figure it out how this works. What also interest me
> > is
> > how other programs do this.
> >
> > Hopefully someone can help me with suggestions, sample or websites with
> > information about this topic.
> >
> > Thanks in advance.
> >
> > Tim
> >
> > O yes, I posted this message in two newsgroups because I develop in VB6
> > and/or .Net so don't' shout at me please.
>
> Hi,
> You can assign a timer control to the barcode scanning form on load,
> then set a reasonable interval that queries your code will scan for
> barcodes, then put the barcode scanning code in that timer1.tick
> event. If you need any if-then statements set them also.
>
> Also look at control (your textbox).lostfocus event to determine what
> message or action you need to when your control loses focus. If it
> doesn't work look for "enter" and "leave" events.
>
> Hope this helps.
>
>



Re: Scanning barcodes (urgent) by Thomas

Thomas
Thu Mar 27 09:13:56 CDT 2008

Dick Grier is right that the serial communications approach is the
best way to go although you may not need to purchase a new scanner.
You should check with the manufacturer of your bar code scanner to see
if they have a "Virtual COM Port" driver for your scanner that you can
use instead of the "keyboard wedge" interface.
Most USB scanners come from the factory configured as a "keyboard" and
when you connect them to the USB port on a PC, Windows loads the built
in Windows USB keyboard driver and the scanner works as a second
keyboard connected to your PC. Metrologic, Handheld Products and most
other scanner manufacturers also have special "Virtual COM Port"
drivers that you can use although you may have to download the special
driver from the manufacturers web site. What you have to do is to
first install the Virtual COM port driver in your PC and then you have
to scan a special bar code in the users manual for the scanner that
will switch it from a keyboard wedge scanner to a "serial" scanner.
This basically reprograms the scanner so that when you connect it to
the USB port on your PC, the new Virtual COM port driver will load
instead of the original keyboard driver.
The driver will create a COM port that will show up in your Windows
Device Manager typically as COM4 or COM5.
You would then use serial communications code in your application to
read in the data from the scanner through the COM port.




On Thu, 13 Mar 2008 10:25:41 +0100, "tim" <tnieuw@hotmail.com> wrote:

>Hi all
>
>
>
>I have made a application that scans barcode. The barcode scanner is connect
>to the PC via one of the USB ports.
>
>
>
>The technique that I use is hidden textbox that constantly has the focus to
>process the input on the keydown event. This works fine.
>
>
>
>It goes wrong when the user clicks for instance on one of the listboxes.
>Before start scanning the user has to click on a button on the toolbar first
>to set the focus back on the textbox. In some other cases I can do that in
>code.
>
>
>
>My customer has problems to click on the button first to start scanning
>again. My question is if there is a other method that constantly receives
>input from a barcode scanner and process it. If have tried to monitor the
>USB port but I can't figure it out how this works. What also interest me is
>how other programs do this.
>
>
>
>Hopefully someone can help me with suggestions, sample or websites with
>information about this topic.
>
>
>
>Thanks in advance.
>
>Tim
>
>
>
>
>
>O yes, I posted this message in two newsgroups because I develop in VB6
>and/or .Net so don't' shout at me please.
>