BarCode Scanner

              Windev supports Bar code scanner device via Serial Port, Parallel Port and IR Port. Serial Port connection only allows the read function. Many systems have parallel ports default. So we need to convert Parallel Port to Serial port to use windev functions.

To convert a Parallel Port to Serial port we need to do some configurations. 
  •            Install HSM USB Serial Driver
  •                   First we need to scan particular barcode given with HSM USB Serial Driver


Codes to connect a Barcode Scanner via Serial Port :

                      // 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(nSerialPort50005000) 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(nSerialPortnNbPendingByte
                                         // Retrieve the first 13 characters read 
                           
sBuffer = Left(sBuffer13
                                       // Display the value of the bar code 
                                       // in the "EDT_BarCode" edit control 
                             EDT_BarCode = sBuffer 
                  END 
           END

Comments

Popular posts from this blog

Word Processing Control

Read XML String and load the data in Controls

Track Directory