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)
  • Read a barcode in a WEBDEV site
  • Reading a bar code found in an image
  • Reading a bar code in a Windows Mobile application
  • Reading bar codes with a Windows Mobile application
  • Reading a QR Code bar code found in an image (physical image or memory image)
  • Reading a bar code in an Android application
  • Direct reading of bar codes with an Android application
  • Reading a bar code in an iPhone/iPad application
  • Direct reading of QR Code bar codes (BCCapture function)
  • Direct reading of bar codes (Camera control)
  • Reading a bar code found in an image
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.
    For more details, see Reading a bar code in a WINDEV application.
  • WEBDEV - Server code In WEBDEV, it is possible to read a barcode present in an Image.
    For more details, see Read a barcode in a WEBDEV site.
  • Windows Mobile In most cases, in the Windows Mobile applications, the bar codes are read via industrial devices. In most cases, a single type of bar code can be read by the industrial device.
    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 Windows Mobile application.
  • Versions 16 and later
    Android In the Android applications, the bar code is read via the camera of the device.
    For more details, see Reading a bar code in an Android application.
    New in version 16
    Android In the Android applications, the bar code is read via the camera of the device.
    For more details, see Reading a bar code in an Android application.
    Android In the Android applications, the bar code is read via the camera of the device.
    For more details, see Reading a bar code in an Android application.
  • iPhone/iPad In iPhone/iPad applications, it is possible to read a wide variety of bar codes. It is possible to:
    • read the bar code via the device camera.
    • read a bar code found in an image.
    For more details, see Reading a bar code in an iOS 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:
    • sOpenwhich opens and initializes the specified serial port (or parallel port).
    • sReadwhich reads a string from 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 that contains 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 an Variable of type BarCode 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 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: "+ cb.Contenu)
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 found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare an Variable of type BarCode 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 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: "+ cb.Contenu)
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 found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare an Variable of type BarCode 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 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: "+ cb.Contenu)
END
Read a barcode in a WEBDEV site
WEBDEV - Server code

Reading a bar code found in an image

In WEBDEV sites, it is also possible to read the characteristics of a barcode present in an Image.
To read a bar code found in an image:
  1. Select the image that contains 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 an Variable of type BarCode if necessary. The characteristics of the bar code will be saved in this variable.
  3. Use the BCDecode function to decode the barcode.
Example of get of a barcode present in an Image control:
// Decode a QR Code found in an Image control
bc is BarCode
bc = BCDecode(IMG_BarCode)
IF ErrorOccurred = False _AND_ bc.TypeBarCode = BC_QRCODE ...
_AND_ bc.TypeContent =  bcTypeEmail THEN
Info("Email address: "+ cb.Contenu)
END
Reading a bar code in a Windows Mobile application
Windows Mobile

Reading bar codes with a Windows Mobile application

Most of the constructor of industrial devices propose two modes for reading the bar codes:
  • A "Wedge" mode: no specific programming is required. The user must set the position at the desired control and scan the bar code. The control immediately receives the value of the bar code.
  • A use of their specific libraries: this method proposes an improved management of the bar codes but it requires a specific interfacing. Several examples and components are supplied with WINDEV Mobile to handle the specific devices.
Versions 16 and later
Windows Mobile

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 found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare an Variable of type BarCode 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 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: "+ cb.Contenu)
END
New in version 16
Windows Mobile

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 found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare an Variable of type BarCode 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 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: "+ cb.Contenu)
END
Windows Mobile

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 found in an Image control.
    • an image file.
    • an image found in memory.
  2. Declare an Variable of type BarCode 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 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: "+ cb.Contenu)
END
Reading a bar code in an Android application
Android

Direct reading of bar codes with an Android application

Two modes are available for reading bar codes:
  • Reading bar codes with BCCapture. This function decodes the information stored in a bar code by using the camera of the device.
    Remarks:
    • This function opens a new window that displays the preview from the device camera. Then, you must:
      • center the bar code to decode in the relevant area.
      • validate like for a standard snapshot.
    • Under Android, barcode decoding uses the Zxing library (http://code.google.com/p/zxing). If this library is not found on the device, it will be automatically proposed for download.
  • Versions 21 and later
    Reading bar codes via the Camera control.
    All you have to do is enable the reading of bar codes in the Camera control. A specific process is run whenever the bar code is read. This process is used to get the characteristics of the bar code read in a BarCode variable. For more details, see Camera control: decoding the bar codes.
    New in version 21
    Reading bar codes via the Camera control.
    All you have to do is enable the reading of bar codes in the Camera control. A specific process is run whenever the bar code is read. This process is used to get the characteristics of the bar code read in a BarCode variable. For more details, see Camera control: decoding the bar codes.
    Reading bar codes via the Camera control.
    All you have to do is enable the reading of bar codes in the Camera control. A specific process is run whenever the bar code is read. This process is used to get the characteristics of the bar code read in a BarCode variable. For more details, see Camera control: decoding the bar codes.
Reading a bar code in an iPhone/iPad application
iPhone/iPad

Direct reading of QR Code bar codes (BCCapture function)

The direct reading of bar codes is performed by BCCapture. This function decodes the information stored in a bar code by using the camera of the device.
Remark: This function opens a new window that displays the preview from the device camera. Then, you must:
  • center the bar code to decode in the relevant area.
  • validate like for a standard snapshot.
The characteristics of the bar code read are stored in a BarCode variable. The value of the barcode can be known by the Property ValueBrute and displayed in an Bar Code control.
For example:
// Capture the bar code
MonCB is an BarCode
MyBC = BCCapture()
 
// Retrieve the content of the bar code and display it
sResult is string = MyBC.RoughValue
BCOD_MyBarCodeControl = sResult
Versions 21 and later
iPhone/iPad

Direct reading of bar codes (Camera control)

The direct reading of bar codes is run via the Camera control used in decoding mode.
Remark: The user frames the bar code. A specific process is run whenever the bar code is read. This process is used to get the characteristics of the bar code read in a BarCode variable. The value of the barcode can be known by the Property ValueBrute and displayed in an Bar Code control.
For example:
// Decoding a Bar Code process
PROCEDURE DecodeBarCode(bc is BarCode)
// Retrieve the content of the bar code and display it
sResult is string = bc.RoughValue
BCOD_MyBarCodeControl = sResult
For more details, see Camera control: decoding the bar codes.
New in version 21
iPhone/iPad

Direct reading of bar codes (Camera control)

The direct reading of bar codes is run via the Camera control used in decoding mode.
Remark: The user frames the bar code. A specific process is run whenever the bar code is read. This process is used to get the characteristics of the bar code read in a BarCode variable. The value of the barcode can be known by the Property ValueBrute and displayed in an Bar Code control.
For example:
// Decoding a Bar Code process
PROCEDURE DecodeBarCode(bc is BarCode)
// Retrieve the content of the bar code and display it
sResult is string = bc.RoughValue
BCOD_MyBarCodeControl = sResult
For more details, see Camera control: decoding the bar codes.
iPhone/iPad

Direct reading of bar codes (Camera control)

The direct reading of bar codes is run via the Camera control used in decoding mode.
Remark: The user frames the bar code. A specific process is run whenever the bar code is read. This process is used to get the characteristics of the bar code read in a BarCode variable. The value of the barcode can be known by the Property ValueBrute and displayed in an Bar Code control.
For example:
// Decoding a Bar Code process
PROCEDURE DecodeBarCode(bc is BarCode)
// Retrieve the content of the bar code and display it
sResult is string = bc.RoughValue
BCOD_MyBarCodeControl = sResult
For more details, see Camera control: decoding the bar codes.
iPhone/iPad

Reading a bar code found in an image

In iPhone/iPad applications, it is also possible to read the characteristics of a bar code in an image.
To read a bar code found in an image:
  1. Select the image that contains 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 an Variable of type BarCode if necessary. The characteristics of the bar code will be saved in this variable.
  3. Use the BCDecode function to decode the barcode.
Example for reading a bar code read by a Web Camera and stored in memory:
// Decode a QR Code found in an Image control
bc is BarCode
bc = BCDecode(IMG_BarCode)
IF ErrorOccurred = False _AND_ bc.TypeBarCode = BC_QRCODE ...
_AND_ bc.TypeContent =  bcTypeEmail THEN
Info("Email address: "+ cb.Contenu)
END
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