Sample code for 30+ languages & platforms
PowerBuilder Requires Chilkat v11.7.0+

Get the QR Code Capabilities of the Chilkat Version in Use

See more QR Code Examples

Demonstrates the capabilities operation, which describes what the installed version of Chilkat can do: the range of QR versions, the error-correction levels, the operations, the image formats and the limits. A program can check for a feature here instead of testing for a Chilkat version number. The request can be an empty JSON object.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
long li_Success
oleobject loo_Json
oleobject loo_Fmt
oleobject loo_JsonOut
long i
long n

li_Success = 0

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
if li_rc < 0 then
    destroy loo_Json
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_Fmt = create oleobject
li_rc = loo_Fmt.ConnectToNewObject("Chilkat.Formats")

loo_JsonOut = create oleobject
li_rc = loo_JsonOut.ConnectToNewObject("Chilkat.JsonObject")

li_Success = loo_Fmt.QrCode("capabilities",loo_Json,loo_JsonOut)
if li_Success = 0 then
    Write-Debug loo_Fmt.LastErrorText
    destroy loo_Json
    destroy loo_Fmt
    destroy loo_JsonOut
    return
end if

Write-Debug "Chilkat version: " + loo_JsonOut.StringOf("productVersion")
Write-Debug "symbology: " + loo_JsonOut.StringOf("symbologies[0].id")
Write-Debug "QR versions: " + string(loo_JsonOut.IntOf("symbologies[0].encoding.version.min")) + " to " + string(loo_JsonOut.IntOf("symbologies[0].encoding.version.max"))
Write-Debug "structured append, most symbols: " + string(loo_JsonOut.IntOf("symbologies[0].structuredAppend.maxSymbols"))

n = loo_JsonOut.SizeOfArray("symbologies[0].encoding.errorCorrection")
for i = 0 to n - 1
    loo_JsonOut.I = i
    Write-Debug "error correction: " + loo_JsonOut.StringOf("symbologies[0].encoding.errorCorrection[i]")
next

//  The operations this version implements.
n = loo_JsonOut.SizeOfArray("operations")
for i = 0 to n - 1
    loo_JsonOut.I = i
    if loo_JsonOut.BoolOf("operations[i].available") = 1 then
        Write-Debug "operation: " + loo_JsonOut.StringOf("operations[i].name")
    end if

next

n = loo_JsonOut.SizeOfArray("imageFormats.output")
for i = 0 to n - 1
    loo_JsonOut.I = i
    Write-Debug "image format: " + loo_JsonOut.StringOf("imageFormats.output[i]")
next

Write-Debug "default timeout: " + string(loo_JsonOut.IntOf("limits.timeoutMs.default")) + " ms"
Write-Debug "default largest image: " + string(loo_JsonOut.IntOf("limits.maxPixels.default")) + " pixels"

//  Sample output:

//  Chilkat version: 11.7.0
//  symbology: qr
//  QR versions: 1 to 40
//  structured append, most symbols: 16
//  error correction: auto
//  error correction: L
//  error correction: M
//  error correction: Q
//  error correction: H
//  operation: generate
//  operation: measure
//  operation: validate
//  operation: capabilities
//  image format: png
//  image format: svg
//  default timeout: 10000 ms
//  default largest image: 16777216 pixels


destroy loo_Json
destroy loo_Fmt
destroy loo_JsonOut