1. Udaya Shankar Rao
  2. PowerBuilder
  3. Thursday, 30 August 2018 15:49 PM UTC
Hi,
Need help & suggestion on bar code / qr code scanner.
 
I have PowerBuilder 10.5 application which is running in Windows 10 tablet. Now, I have a requirement to add the Bar code / QR Code scan functionality in built in this application. That means, using the scanner software or by any means(By taking the help of inbuilt camera), bar code / qr code need to be scanned & data need to be passed to PB application within the tablet itself. External Bar code / QR Code scanners are not used. How can we achieve this? Which bar code / qr code scanner software supports this? Do you have any suggestion or Idea in this regard? 
Udaya Shankar Rao Accepted Answer Pending Moderation
  1. Monday, 3 September 2018 05:40 AM UTC
  2. PowerBuilder
  3. # 1

Thank you for your responses. I will explore.

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Friday, 31 August 2018 05:42 AM UTC
  2. PowerBuilder
  3. # 2

To read data from a barcode scanner on a serial COM port using Windows API here is a shortened example:

 

// you need to declare some external API functions// and some structures// it is nothing complex - just simple google for it
// open the COM portCONSTANT long   EV_RXCHAR = 0
CONSTANT long   GENERIC_READ = 2147483648
CONSTANT long   GENERIC_WRITE = 1073741824
CONSTANT long   FILE_SHARE_NONE = 0
CONSTANT long   OPEN_EXISTING = 1
CONSTANT long   PURGE_TXABORT = 1
CONSTANT long   PURGE_RXABORT = 1
CONSTANT long   PURGE_TXCLEAR = 1
CONSTANT long   PURGE_RXCLEAR = 1
CONSTANT long   FF_OVERLAPPED = 0
 
if li_comPort = 1 then
      ls_port = "COM1:"
      ls_port_description = "COM1: 9600,N,8,1"
elseif li_comPort = 2 then
      ls_port = "COM2:"
      ls_port_description = "COM2: 9600,N,8,1"
elseif li_comPort = 3 then
      ls_port = "COM3:"
      ls_port_description = "COM3: 9600,N,8,1"
elseif li_comPort = 4 then
      ls_port = "COM4:"
      ls_port_description = "COM4: 9600,N,8,1"
else
      li_comPort = 0
      messagebox("Port Error","An invalid com port was passed to the open port function")
end if
 
setnull(ll_null)
 
li_comPort = CreateFileW(ls_port, GENERIC_READ, FILE_SHARE_NONE, ll_null, OPEN_EXISTING, FF_OVERLAPPED, ll_null)
 
IF li_comPort < 0 THEN
    // error
else
      // Set the port variables
      ll_return_cd = BuildCommDCBW(ls_port_description,str_DCB)
      
      if ll_return_cd = 0 then
            // error
      else
            ll_return_cd = SetCommState(li_comPort,str_DCB)
      end if
      
   // Setup the Comm mask
   if SetCommMask(li_comPort, EV_RXCHAR) = FALSE then
            // error
      end if
      
      // Setup the buffers
   if SetupComm(li_comPort, 4096, 4096) = FALSE then
            // error
      end if
 
   // Flush the Port's buffer
   if FlushFileBuffers(li_comPort) = FALSE then
            // error
      end if
 
   // Purge the Port
   if PurgeComm(li_comPort, PURGE_TXABORT + PURGE_RXABORT + PURGE_TXCLEAR + PURGE_RXCLEAR) = FALSE then
            // error
      end if
 
   // Setup Timeouts
      SetComTimeout(1500)
end if



MessageBox ("Information", "Scan now!")


// readls_buffer = blob (space(ll_read_length))

lst_overlapped.internal = 0
lst_overlapped.internalhigh = 0
lst_overlapped.offset = 0
lst_overlapped.offsethigh = 0
lst_overlapped.hevent = 0
 
lb_return = ReadFile(li_comPort, lblob_buffer, ll_read_length, ll_bytes_read, lst_overlapped)

ls_text = string (lblob_buffer, EncodingAnsi!)



// closeCloseHandle(li_comPort)

 

 

Comment
There are no comments made yet.
Shenn Sellers Accepted Answer Pending Moderation
  1. Thursday, 30 August 2018 21:49 PM UTC
  2. PowerBuilder
  3. # 3

The barcode scanners and readers just convert the barcode into text.  We use external barcode readers in many of our applications.  You scan the barcode, the text is inserted into whatever field you are on in your application, and then you process the results.  There isn't much to it when using an external barcode scanner.

If you want to use the built-in camera on your Windows Tablet, you will have to find an app that will work for you.  I just did a quick Google search and found a bunch of free barcode reader applications.  However, the trouble with this approach, is you have to figure out a way to get the data from the barcode app into your PB app.  I don't know if you will be able to find anything for free to do this.  One purchasable option can be found below.  It has a trial so you can test it out.

https://www.tec-it.com/en/software/data-acquisition/twedge/keyboard-wedge/Default.aspx

 

Comment
  1. Armeen Mazda @Appeon
  2. Thursday, 30 August 2018 22:11 PM UTC
Those barcode scanners that just convert the barcode into text is probably the simplest solution, and are able to more quickly/reliably scan bar codes than a camera because they use laser. Of course, it has extra cost and extra device to carry around.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.