Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 9 Monaten
Letzter Beitrag:
vor 2 Jahren, 8 Monaten
Beteiligte Autoren:
Sammy Broeders, DarrenF, Patrick Thijs, Paulo Oliveira, Bart VDE, CCC2, Stewart Crisler

Windev 20 with barcode scanner

Startbeitrag von Sammy Broeders am 17.09.2015 15:19


I just look for the possibilitys with windev and a barcode scanner. I want to print a barcode on a report wich i can scan with a scanner for the work hours registration and put the worked hours in a database.
Is there someone who has experience with something like this? Is it possible to do and what kind of scanner do i need?
Is it possible with this scanner; https://www.conrad.nl/nl/manhattan-barcodescanner-contact-178488-laser-zwart-usb-806696.html?WT.mc_id=gshop&gclid=COjcst6u_scCFYqRGwodJwYEJA&WT.srch=1

Thanks all!


I never used this one but in theory it's possible.
You can print bar codes with the same type used by the reader you propose.

The proposed reader works as one keyboard so when you scan the barcode it will put the value of the bar code in the current control.

Normally this kind of readers sends one TAB at the end if so you only need to check if that key was pressed and act accordingly.


von Paulo Oliveira - am 17.09.2015 15:39
Hey Sammy,

Barcode scanners are really easy to implement. As Paulo says, they just act as an input device like a keyboard. If you want to scan numbers with decimal elements, I've never tried to scan 123.45 for example.

Your suggested scanner will of course work, but if the scanner is just for your own "test-bed", then why spend so much?

Something like this will do just as well:


von DarrenF - am 17.09.2015 17:30
Thanks for the response!

I have ordered a scanner so i wil try with it.

von Sammy Broeders - am 18.09.2015 13:36
Great Sammy.
When it arrives plug it in, grab yourself something with a barcode on it, open something like notepad and "bleep"!

von DarrenF - am 18.09.2015 14:58
keep the manual that come with the scanner , you need to scan the bar code in the manual to change the scanner setting.

von CCC2 - am 18.09.2015 16:41
It's really piece of cake, most barcode readers emulate keyboard-input.
So al you have to do is to "catch" the data that comes from the reader into an Edit-control and proces the data.
Keep in mind that the barcod reader that you are going to buy is a CCD-reader, wich is less accurate for reading from a distance. But normally it will work fine



von Patrick Thijs - am 18.09.2015 21:53
Using WinDev 19 to generate bar code enabled program for windows 8 tablet.

Bar code scanner connects via Blue Tooth as two RS232 ports. One port will be used for input and one port for output. You then use the WinDev COM port commands to capture the scans and feed to a designated procedure. In the procedure you update whatever you need. Tablet communicates with the host server computer via Wifi.

I much prefer this kind of connectivity to a a "keyboard wedge" because the user does not have to be positioned in a particular field. I handle that in my programming by tracking where they are in the process and feeding the data to the correct fields or via prefix characters in the bar code.

So yes bar coding works with WinDev.

Stewart Crisler

von Stewart Crisler - am 22.09.2015 18:11
Hello Stewart,

Is this also possible with my USB reader? I also not prefer the use of a edit box.

von Sammy Broeders - am 22.09.2015 20:24
according to the information on the Conrad website, you can use this scanner in RS-232 mode (virtual comport)
Programming the operational mode of the scanner is most of the time done by scanning special barcodes from the manual



von Patrick Thijs - am 22.09.2015 20:40
Hello all,

The scanner is not work in RS-232 mode, in the guide there are special codes to scan also for RS-232 mode.
Is there someone who has an example code?

von Sammy Broeders - am 24.09.2015 14:12
Hi Sammy,

"example code" for what? I presume you purchased the barcode reader from your initial post?

Why are you using RS-232 mode when it's a USB scanner; it should just be P-n-P. Nothing to setup, nothing to change, doesn't need code (apart from handling the input value)... just P-n-P.

If I'm on the wrong track, why not let us know how you intend to use the scanner for? :spos:

von DarrenF - am 24.09.2015 14:53

You are right, it`s a usb scanner and it is pnp. (keyboard wedge) But then i need Always a focus on a edit box.
It is for a time registration program, so different persons has to scan with it and it has to be very easy for them to use. (So don`t need anything else then the scanner)

von Sammy Broeders - am 24.09.2015 15:12

Yeah, I have the same requierment on an epos window using a "barcode" field. I use SetFocus and/or ReturnToCapture functions depending on requirements.

At a basic level, you need to do something like:
- in the initialisation of the window, set focus to the field that will contain the scanned value.
- when a value is input/scanned and focus "tries" to move away from the field, in the exit event of the field, do some processing like reading a record from the DB. In my system this is carried out in the exit event of the field because my scanner "presses return" for me automatically after a scan.
- still in the exit event, clear stuff down like variables and prepare for the next scan.
- still in the exit event, set focus back to the scanned field again.

...this way you never actually leave the scanned field.

My implementation is a little more complex because I allow the user to go off to do other "view only" things, but as soon as they've done what they need to do, I setfocus/returntocapture and take them straight back to the scan field again.

von DarrenF - am 24.09.2015 15:36
Returntocapture is your friend :-)

I do it in several programs, the edit-control that catches the results from the barcodescanner is invisible, and it works perfect



von Patrick Thijs - am 24.09.2015 17:14
We use it a lot in keyboard emulation mode but not for time registration.

In this case and if you want to prevent the user from using the keyboard to input the same number as the scanner you can check the time spent between keys, the scanner is a lot faster than the keyboard.

von Paulo Oliveira - am 24.09.2015 17:24

Just put a edit control on your form (invisible or not), and in the description tab of the edit control (GUI tab), define which key combination is the shortcut of your edit control.

Example : many scanners will send by default a STX (Start of Text, ASCII value 2) before sending the actual barcorde, and send a return at the end of the barcode (but you can program your scanner with whatever prefix and suffix code you want)

In this case, set the shortcut for your edit control = CTRL+B (=STX)
When you scan a barcode, your barcode will be automaticly put in the edit control .
Put also a button on your form with shortcut=RETURN, this button will be invoked when all the barcode characters are in your edit control. In the keypress event of the button you put your code the process the barcode.


von Bart VDE - am 25.09.2015 06:35
Thanks Bart!

The STX function works great for me.

von Sammy Broeders - am 25.09.2015 07:59
Is the code in the keypress event the correct place?

My code is in the exit event as I don't need to monitor each keypress and it slows the input down slightly. My code is in the exit event as I only need to process the full barcode value.

Also, one lesson I learnt... make sure the history of field entries is turned OFF as this drastically slows down input especially when using barcode scanning :eek:

von DarrenF - am 25.09.2015 08:53

My mistake. Put your code for processing your barcode in the click event of a button. Set the shortcut of your button = the suffix sent by your scanner


von Bart VDE - am 25.09.2015 09:20
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.