Scanning barcodes (urgent)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tim

    Scanning barcodes (urgent)

    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.


  • =?ISO-8859-15?Q?Mathias_W=FChrmann?=

    #2
    Re: Scanning barcodes (urgent)

    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

    Comment

    • tim

      #3
      Re: Scanning barcodes (urgent)

      Hi Mathias,

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

      Tim

      "Mathias Wührmann" <usenet@flexact .deschreef in bericht
      news:ekambDPhIH A.748@TK2MSFTNG P04.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

      Comment

      • Dick Grier

        #4
        Re: Scanning barcodes (urgent)

        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.


        Comment

        • Thomas Lutz

          #5
          Re: Scanning barcodes (urgent)

          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 .comwrote:
          >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.
          >

          Comment

          Working...