PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | French EN
  • 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 Windows Mobile application
  • 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/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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.
    See Reading a bar code in a WINDEV application for more details.
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, that is used to open and initialize the specified serial port (or parallel port).
    • sRead, that is used to read a character 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:
// Declare the variables
// Define the number of characters that must be read
nNbCharToRead is int = 13
// Number of pending bytes in the buffer
nNbPendingByte is int
sBuffer is string       // Content of the buffer
nSerialPort is int = 1 // COM1 serial port
 
// Open and initialize the serial port COM1
IF sOpen(nSerialPort, 5000, 5000) THEN
// Read the bar code
// Retrieve the number of pending bytes
nNbPendingByte = sInEntryQueue(nSerialPort)
// Retrieve the value of the bar code only
// if at least 13 characters have been read
IF nNbPendingByte >= nNbCharToRead THEN
sBuffer = sRead(nSerialPort, nNbPendingByte)
// Retrieve the first 13 characters read
  sBuffer = Left(sBuffer, 13)
// Display the value of the bar code
// in the "EDT_BarCode" edit control
EDT_BarCode = 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 containing the bar code to decode. This image can be:
    • an image found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare (if necessary) a BarCode variable. The characteristics of the QR Code bar code will be saved in this variable.
  3. Use BCDecode to decode the QR Code bar code.
Example for reading a bar code read by a Web Camera and stored in memory:
// Decode a QR Code from a Camera control
s is Buffer
s = dSaveImageBMP(CAM_MyCamera, inMemory)
bc is BarCode
bc = BCDecode(s)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..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 containing the bar code to decode. This image can be:
    • an image found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare (if necessary) a BarCode variable. The characteristics of the QR Code bar code will be saved in this variable.
  3. Use BCDecode to decode the QR Code bar code.
Example for reading a bar code read by a Web Camera and stored in memory:
// Decode a QR Code from a Camera control
s is Buffer
s = dSaveImageBMP(CAM_MyCamera, inMemory)
bc is BarCode
bc = BCDecode(s)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..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 containing the bar code to decode. This image can be:
    • an image found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare (if necessary) a BarCode variable. The characteristics of the QR Code bar code will be saved in this variable.
  3. Use BCDecode to decode the QR Code bar code.
Example for reading a bar code read by a Web Camera and stored in memory:
// Decode a QR Code from a Camera control
s is Buffer
s = dSaveImageBMP(CAM_MyCamera, inMemory)
bc is BarCode
bc = BCDecode(s)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..Content)
END
Reading a bar code in a Windows Mobile application
Reading a bar code in an Android application
Reading a bar code in an iPhone/iPad application
Related Examples:
Pocket Attendance Mobile (WINDEV Mobile): Pocket Attendance
[ + ] This application is an attendance manager. It allows you to list the persons who attended a meeting.
The database is previously filled with the list of registered persons.
A bar code reader can be used to read the identifiers of the persons.
The following topics are presented in this example:
1/ the click performed on a table column
2/ the use of a browsing table
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