PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • 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 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 QR Code bar code in an iPhone/iPad application
  • Direct reading of QR Code bar codes (BCCapture function)
  • Reading a QR Code found in an image
  • 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.
    See Reading a bar code in a WINDEV application for more details.
  • 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.
    See Reading a bar code in a Windows Mobile application for more details.
  • Versions 16 and later
    Android In the Android applications, the bar code is read via the camera of the device.
    See Reading a bar code in an Android application for more details.
    New in version 16
    Android In the Android applications, the bar code is read via the camera of the device.
    See Reading a bar code in an Android application for more details.
    Android In the Android applications, the bar code is read via the camera of the device.
    See Reading a bar code in an Android application for more details.
  • Versions 17 and later
    iPhone/iPad In the iPhone/iPad applications, only the QR Code bar codes can be read. You can:
    • read the QR code bar code via the camera of the device.
    • read a QR bar code found in an image.
    See Reading a bar code in an iOS application for more details.
    New in version 17
    iPhone/iPad In the iPhone/iPad applications, only the QR Code bar codes can be read. You can:
    • read the QR code bar code via the camera of the device.
    • read a QR bar code found in an image.
    See Reading a bar code in an iOS application for more details.
    iPhone/iPad In the iPhone/iPad applications, only the QR Code bar codes can be read. You can:
    • read the QR code bar code via the camera of the device.
    • read a QR bar code found in an image.
    See Reading a bar code in an iOS application for more details.
    iPhone/iPad Several bar codes can be read in the iPhone/iPad applications. You can:
    • read the bar code via the device camera.
    • read a bar code found in an image.
    See Reading a bar code in an iOS 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.
Note: 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 BarCodes 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 BarCodes
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 BarCodes 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 BarCodes
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 BarCodes 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 BarCodes
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
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 be positioned in the requested 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 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 BarCodes 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 BarCodes
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
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 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 BarCodes 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 BarCodes
bc = BCDecode(s)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..Content)
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 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 BarCodes 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 BarCodes
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 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.
    Notes:
    • 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.
    • In Android, the feature for decoding bar codes is using 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 BarCodes variable. See Camera control: decoding the bar codes for more details.
    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 BarCodes variable. See Camera control: decoding the bar codes for more details.
    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 BarCodes variable. See Camera control: decoding the bar codes for more details.
Reading a QR Code bar code in an iPhone/iPad application
Versions 17 and later
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 QR Code bar code by using the device camera.
Note: 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 BarCodes variable. The value of the bar code is returned by ..RoughValue and it is displayed in the Bar Code control.
For example:
// Capture the bar code
MyBC is BarCodes
MyBC = BCCapture()

// Retrieve the content of the bar code and display it
sResult is string = MyBC..RoughValue
BCOD_MyBarCodeControl = sResult
New in version 17
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 QR Code bar code by using the device camera.
Note: 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 BarCodes variable. The value of the bar code is returned by ..RoughValue and it is displayed in the Bar Code control.
For example:
// Capture the bar code
MyBC is BarCodes
MyBC = BCCapture()

// Retrieve the content of the bar code and display it
sResult is string = MyBC..RoughValue
BCOD_MyBarCodeControl = sResult
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 QR Code bar code by using the device camera.
Note: 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 BarCodes variable. The value of the bar code is returned by ..RoughValue and it is displayed in the Bar Code control.
For example:
// Capture the bar code
MyBC is BarCodes
MyBC = BCCapture()

// Retrieve the content of the bar code and display it
sResult is string = MyBC..RoughValue
BCOD_MyBarCodeControl = sResult
Versions 17 and later
iPhone/iPad

Reading a QR Code found in an image

In the iPhone/iPad applications, you also have the ability to read the characteristics of a QR Code found in an 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 a BarCodes variable if necessary. 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 found in an Image control
bc is BarCodes
bc = BCDecode(IMG_BarCode)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..Content)
END
New in version 17
iPhone/iPad

Reading a QR Code found in an image

In the iPhone/iPad applications, you also have the ability to read the characteristics of a QR Code found in an 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 a BarCodes variable if necessary. 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 found in an Image control
bc is BarCodes
bc = BCDecode(IMG_BarCode)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..Content)
END
iPhone/iPad

Reading a QR Code found in an image

In the iPhone/iPad applications, you also have the ability to read the characteristics of a QR Code found in an 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 a BarCodes variable if necessary. 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 found in an Image control
bc is BarCodes
bc = BCDecode(IMG_BarCode)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..Content)
END
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.
Note: 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 BarCodes variable. The value of the bar code is returned by ..RoughValue and it is displayed in the Bar Code control.
For example:
// Capture the bar code
MyBC is BarCodes
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.
Note: 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 BarCodes variable. The value of the bar code is returned by ..RoughValue and it is displayed in the Bar Code control.
For example:
// Decoding a Bar Code process
PROCEDURE DecodeBarCode(bc is BarCodes)
// Retrieve the content of the bar code and display it
sResult is string = bc..RoughValue
BCOD_MyBarCodeControl = sResult
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.
Note: 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 BarCodes variable. The value of the bar code is returned by ..RoughValue and it is displayed in the Bar Code control.
For example:
// Decoding a Bar Code process
PROCEDURE DecodeBarCode(bc is BarCodes)
// Retrieve the content of the bar code and display it
sResult is string = bc..RoughValue
BCOD_MyBarCodeControl = sResult
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.
Note: 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 BarCodes variable. The value of the bar code is returned by ..RoughValue and it is displayed in the Bar Code control.
For example:
// Decoding a Bar Code process
PROCEDURE DecodeBarCode(bc is BarCodes)
// Retrieve the content of the bar code and display it
sResult is string = bc..RoughValue
BCOD_MyBarCodeControl = sResult
iPhone/iPad

Reading a bar code found in an image

In the iPhone/iPad applications, you also have the ability to read the characteristics of a bar code found in an image.
To read a 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 BarCodes variable. The characteristics of the bar code will be saved in this variable.
  3. Use BCDecode to decode the bar code.
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 BarCodes
bc = BCDecode(IMG_BarCode)
IF ErrorOccurred = False _AND_ bc..TypeBarCode = BC_QRCODE ...
_AND_ bc..TypeContent =  bcTypeEmail THEN
Info("Email address: " + bc..Content)
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 required version
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment