PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Overview
  • Reading a bar code in a WINDEV application
  • Reading bar codes with a WINDEV application: Using a specialized device
  • Reading a QR Code bar code found in an image (physical image or memory image)
  • Reading a bar code in a WEBDEV site
  • Reading a bar code in an Android application
  • Reading a bar code in an iPhone/iPad application
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WINDEV, WEBDEV and WINDEV Mobile allow you to create applications for reading bar codes.
  • WINDEV In WINDEV, the bar codes are read via a specific device plugged into the serial port of the computer.
    Versions 16 and later
    For the QR Code bar codes, you also have the ability to read a bar code found in an image.
    New in version 16
    For the QR Code bar codes, you also have the ability to read a bar code found in an image.
    For the QR Code bar codes, you also have the ability to read a bar code found in an image.
    For more details, see Reading a bar code in a WINDEV application.
Reading a bar code in a WINDEV application
WINDEV

Reading bar codes with a WINDEV application: Using a specialized device

To read a bar code via a specialized device:
  1. Connect a specific device to the serial port of your computer (depending on the device used, check whether the keyboard is not set to uppercase characters and/or whether the device is configured for an english keyboard).
  2. Read the value of the bar code with the following functions for managing serial ports:
    • sOpen, which opens and initializes the specified serial port (or parallel port).
    • sRead, which reads a string in the input buffer of the specified serial port.
The value of the bar code can be displayed in an edit control.
Remark: A Bar Code control can also be used in the window editor.
Example used to read a bar code with a specific device connected to the serial port COM1:
// Déclaration des variables
// Définition du nombre de caractères à lire
nNbCarALire is int = 13
// Nombre d'octets en attente dans le buffer
nNbOctetAttente is int
sBuffer is string // Contenu du buffer
nPortSérie is int = 1 // Port série COM1
 
// Ouverture et initialisation du port série COM1
IF sOpen(nPortSérie, 5000, 5000) THEN
// Lecture du code-barres
// Récupération du nombre d'octets en attente
nNbOctetAttente = sInEntryQueue(nPortSérie)
// Récupération de la valeur du code-barres uniquement
// si au moins 13 caractères ont été lus
IF nNbOctetAttente >= nNbCarALire THEN
sBuffer = sRead(nPortSérie, nNbOctetAttente)
// Récupération des 13 premiers caractères lus
  sBuffer = Left(sBuffer, 13)
// Affichage de la valeur du code-barres
// dans le champ de saisie "SAI_CodeBarre"
SAI_CodeBarre = sBuffer
END
END
Versions 16 and later
WINDEV

Reading a QR Code bar code found in an image (physical image or memory image)

To read a QR Code bar code found in an image:
  1. Select the image that contains the bar code to decode. This image can be:
    • an image in an Image control.
    • an image file.
    • an image in memory.
  2. Declare a BarCode variable if necessary. The characteristics of the QR Code bar code will be saved in this variable.
  3. Use the BCDecode function to decode the QR Code.
Example: Reading a bar code read by a Web Camera and stored in memory:
// Décodage d'un QR Code à partir d'un champ Caméra
s is Buffer
s = dSaveImageBMP(CAM_MaCaméra, inMemory)
cb is BarCode
cb = BCDecode(s)
IF ErrorOccurred = False _AND_ cb.TypeBarCode = BC_QRCODE ...
_AND_ cb.ContentType = bcTypeEmail THEN
Info("Adresse email: " + cb.Content)
END
New in version 16
WINDEV

Reading a QR Code bar code found in an image (physical image or memory image)

To read a QR Code bar code found in an image:
  1. Select the image that contains the bar code to decode. This image can be:
    • an image in an Image control.
    • an image file.
    • an image in memory.
  2. Declare a BarCode variable if necessary. The characteristics of the QR Code bar code will be saved in this variable.
  3. Use the BCDecode function to decode the QR Code.
Example: Reading a bar code read by a Web Camera and stored in memory:
// Décodage d'un QR Code à partir d'un champ Caméra
s is Buffer
s = dSaveImageBMP(CAM_MaCaméra, inMemory)
cb is BarCode
cb = BCDecode(s)
IF ErrorOccurred = False _AND_ cb.TypeBarCode = BC_QRCODE ...
_AND_ cb.ContentType = bcTypeEmail THEN
Info("Adresse email: " + cb.Content)
END
WINDEV

Reading a QR Code bar code found in an image (physical image or memory image)

To read a QR Code bar code found in an image:
  1. Select the image that contains the bar code to decode. This image can be:
    • an image in an Image control.
    • an image file.
    • an image in memory.
  2. Declare a BarCode variable if necessary. The characteristics of the QR Code bar code will be saved in this variable.
  3. Use the BCDecode function to decode the QR Code.
Example: Reading a bar code read by a Web Camera and stored in memory:
// Décodage d'un QR Code à partir d'un champ Caméra
s is Buffer
s = dSaveImageBMP(CAM_MaCaméra, inMemory)
cb is BarCode
cb = BCDecode(s)
IF ErrorOccurred = False _AND_ cb.TypeBarCode = BC_QRCODE ...
_AND_ cb.ContentType = bcTypeEmail THEN
Info("Adresse email: " + cb.Content)
END
Reading a bar code in a WEBDEV site
Reading a bar code in an Android application
Reading a bar code in an iPhone/iPad application
Related Examples:
The Bar Code control Unit examples (WINDEV): The Bar Code control
[ + ] Using a Bar Code control
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment