Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 5 Monaten
Letzter Beitrag:
vor 1 Jahr, 5 Monaten
Beteiligte Autoren:
DannHCS, Arie, willy hermans

Reading barcode from an usb barcodescanner.

Startbeitrag von willy hermans am 17.01.2017 05:51

Reading a barcode is easy when you give focus to an edit control.

I want to read the content from anywhere in an application without giving focus to an edit control.

It means that a user can get the content of a barcode from the main window. Then the program can do someting. If it was a client card it can select the client. If it was an article it will select the article .
Now it works only when a place an edit control and give focus to it.

Willy Hermans


Hi Willy,

I don't think that an keyboard-scanner is the right device for that. You can't never be sure that a user moves to another control by regular keyboard or mouseclicks. Even when trying be smart (like SetFocus() to the barcode-edit-control every time after a user entered data in normal controls) you will never get 100% reliability.

Best advice is to switch to SERIAL barcode scanner (which can also be USB with a virtual com port) or even an ethernet device. Disadvantage of course is that these are more expensive and harder to program. But will solve you problem for sure.

von Arie - am 17.01.2017 07:55
Hi Willy,
try to use this code.

[Global declarations of the window]
gsLettura is string

[End of initialization of the window]
Event(#LP_Barcode,".*", 256)

[Local procedure #LP_Barcode]
// 13: CR
// 9: TAB

IF NOT _EVE.wParam IN (9,16,13) THEN gsLettura += Charact(_EVE.wParam)
sBarcode is string = gsLettura

sBarcode contains the barcode you are searching for!


von DannHCS - am 17.01.2017 10:42
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.