QR Code DLL API pointer and Power Builder
13 posts • Page 1 of 2 • 1, 2
QR Code DLL API pointer and Power Builder
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?
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
Try declaring as
I do not have PB so I can't verify if it is correct.
- 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.
-
glitch - Support Engineer
- Posts: 198
- Joined: Wed May 14, 2008 2:42 pm
Re: QR Code DLL API pointer and Power Builder
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
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 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.
-
glitch - Support Engineer
- Posts: 198
- Joined: Wed May 14, 2008 2:42 pm
Re: QR Code DLL API pointer and Power Builder
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:
where ls_eol is also a regular string, equals char(13)+char(10)
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
Double check prototype declarations. Can you post them here?
We do not have PB in house so we can't reproduce the issue.
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.
-
glitch - Support Engineer
- Posts: 198
- Joined: Wed May 14, 2008 2:42 pm
Re: QR Code DLL API pointer and Power Builder
- 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
How about
I believe that ref string is needed to pass a string literal.
- 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.
-
glitch - Support Engineer
- Posts: 198
- Joined: Wed May 14, 2008 2:42 pm
Re: QR Code DLL API pointer and Power Builder
Thets what i get:
using example shown above and using String variable to store "test" text, variable value doesn't change after executing the function...
- 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
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.
-
glitch - Support Engineer
- Posts: 198
- Joined: Wed May 14, 2008 2:42 pm
13 posts • Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest