QR Code DLL API pointer and Power Builder

PDF417, Data Matrix, Maxicode, QR Code... 2D bar code formats

QR Code DLL API pointer and Power Builder

Postby Cigaras on Fri May 25, 2012 5:41 am

Hello, has anyone succeeded in using QRCode DLL API in PowerBuilder? I have PowerBuilder version 11.5, using WIndows 7 64bit, not sure how to define pointer variable, so my external funcion looks like this:

Function any QRCodeEncode2 (string dataToEncode, int versionRequested, int ecLevel) Library "MoroviaQRCodeFontEncoder5.dll"

and I get error "Unsuported argument type ...", I am pretty sure it is because of pointer variable, how do I define it in Power Builder?
Cigaras
 
Posts: 5
Joined: Fri May 25, 2012 5:33 am

Re: QR Code DLL API pointer and Power Builder

Postby glitch on Fri May 25, 2012 9:22 am

Try declaring as

Code: Select all
FUNCTION ulong QRCodeEncode2(ref string dataToEncode, long versionRequested, long ecLevel) Library "MoroviaQRCodeFontEncoder5.dll"


I do not have PB so I can't verify if it is correct.
The information above is provided "AS IS", with no warranties, and confers no rights.
User avatar
glitch
Support Engineer
 
Posts: 198
Joined: Wed May 14, 2008 2:42 pm

Re: QR Code DLL API pointer and Power Builder

Postby Cigaras on Mon May 28, 2012 2:49 am

Encode function works, however when i pass ulong variable to QRCodeResultGetBarcodeString() power builder goes down, I don't even get an error message, it stops responding...
Cigaras
 
Posts: 5
Joined: Fri May 25, 2012 5:33 am

Re: QR Code DLL API pointer and Power Builder

Postby glitch on Mon May 28, 2012 9:15 am

QRCodeResultGetBarcodeString requires memory preallocation. You might want to use QRCodeResultGetBarcodeString2 function instead.

The function prototype is like string QRCodeResultGetBarcodeString2(ulong, ref string). See

http://mdn.morovia.com/manuals/qrcode-f ... f8a709dcd2
The information above is provided "AS IS", with no warranties, and confers no rights.
User avatar
glitch
Support Engineer
 
Posts: 198
Joined: Wed May 14, 2008 2:42 pm

Re: QR Code DLL API pointer and Power Builder

Postby Cigaras on Thu May 31, 2012 2:13 am

Thank You, it works, however now I am not sure how to pass string to it to work properly, acording to manual dataToEncode variable is a pointer, so if I pass a regular string, I get some kind of chinese symbols as encoded mesage...

This is how my code looks:
Code: Select all
QRCodeResultGetBarcodeString2(QRCodeEncode2("test", 0, 0), ls_eol)

where ls_eol is also a regular string, equals char(13)+char(10)
Cigaras
 
Posts: 5
Joined: Fri May 25, 2012 5:33 am

Re: QR Code DLL API pointer and Power Builder

Postby glitch on Thu May 31, 2012 10:19 am

Double check prototype declarations. Can you post them here?

We do not have PB in house so we can't reproduce the issue.
The information above is provided "AS IS", with no warranties, and confers no rights.
User avatar
glitch
Support Engineer
 
Posts: 198
Joined: Wed May 14, 2008 2:42 pm

Re: QR Code DLL API pointer and Power Builder

Postby Cigaras on Fri Jun 01, 2012 8:02 am

Code: Select all
Function ulong QRCodeEncode2 (string dataToEncode, int versionRequested, int ecLevel) Library "MoroviaQRCodeFontEncoder5.dll"
Function string QRCodeResultGetBarcodeString2 (ulong pEncodeResult, ref string eol) Library "MoroviaQRCodeFontEncoder5.dll"
Cigaras
 
Posts: 5
Joined: Fri May 25, 2012 5:33 am

Re: QR Code DLL API pointer and Power Builder

Postby glitch on Fri Jun 01, 2012 1:59 pm

How about
Code: Select all
Function ulong QRCodeEncode2 (ref string dataToEncode, int versionRequested, int ecLevel) Library "MoroviaQRCodeFontEncoder5.dll"


I believe that ref string is needed to pass a string literal.
The information above is provided "AS IS", with no warranties, and confers no rights.
User avatar
glitch
Support Engineer
 
Posts: 198
Joined: Wed May 14, 2008 2:42 pm

Re: QR Code DLL API pointer and Power Builder

Postby Cigaras on Tue Jun 05, 2012 7:11 am

Thets what i get:

Code: Select all
㡆䉂㡂う䙃䙁い㡆䉂㡂െ㉅䅁㉁ぅㅆㄷぁ㉅䅁㉁൅㡅㕁䘳㉁䅁㡅㠹㡁㌹䄲൅䄳㈲䄲あ㡄㝂㜲㍄䘳㑁െう䕅ぅう〳㠷㠹ㅁ䐲㉁ു㠸㠸㠸〸〸〸〰〸㠰〸8상邑֊缼ᡁ


using example shown above and using String variable to store "test" text, variable value doesn't change after executing the function...

Code: Select all
String ls_Code, ls_eol
ls_Code = as_Code
ls_eol = char(13)+char(10)
RETURN QRCodeResultGetBarcodeString2(QRCodeEncode2(ls_Code, al_Version, al_Level), ls_eol)
Cigaras
 
Posts: 5
Joined: Fri May 25, 2012 5:33 am

Re: QR Code DLL API pointer and Power Builder

Postby glitch on Fri Apr 19, 2013 4:25 pm

Note that if you are on Powerbuilder 10 and above, the string type is Unicode not the traditional single byte. Functions must be declared with 'ansi' on functions that accepts single-byte string. For example,

Code: Select all
Function string QRCodeResultGetBarcodeString2 (ulong, ref string)  &
library "MoroviaQRCodeFontEncoder5.dll" Alias For " QRCodeResultGetBarcodeString2;Ansi"
The information above is provided "AS IS", with no warranties, and confers no rights.
User avatar
glitch
Support Engineer
 
Posts: 198
Joined: Wed May 14, 2008 2:42 pm

Next

Return to 2D symbologies

Who is online

Users browsing this forum: Google [Bot] and 1 guest