Sample code for 30+ languages & platforms
Xbase++ 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 Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oJson
LOCAL oFmt
LOCAL oJsonOut
LOCAL i
LOCAL n

nSuccess := 0

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

oJson := CreateObject("Chilkat.JsonObject")
oFmt := CreateObject("Chilkat.Formats")
oJsonOut := CreateObject("Chilkat.JsonObject")
nSuccess := oFmt:QrCode("capabilities", oJson, oJsonOut)
IF (nSuccess == 0)
    ? oFmt:LastErrorText
    oJson:destroy()
    oFmt:destroy()
    oJsonOut:destroy()
    RETURN
ENDIF

? "Chilkat version: " + oJsonOut:StringOf("productVersion")
? "symbology: " + oJsonOut:StringOf("symbologies[0].id")
? "QR versions: " + Str(oJsonOut:IntOf("symbologies[0].encoding.version.min")) + " to " + Str(oJsonOut:IntOf("symbologies[0].encoding.version.max"))
? "structured append, most symbols: " + Str(oJsonOut:IntOf("symbologies[0].structuredAppend.maxSymbols"))

n := oJsonOut:SizeOfArray("symbologies[0].encoding.errorCorrection")
FOR i := 0 TO n - 1
    oJsonOut:I := i
    ? "error correction: " + oJsonOut:StringOf("symbologies[0].encoding.errorCorrection[i]")
NEXT

//  The operations this version implements.
n := oJsonOut:SizeOfArray("operations")
FOR i := 0 TO n - 1
    oJsonOut:I := i
    IF (oJsonOut:BoolOf("operations[i].available") == 1)
        ? "operation: " + oJsonOut:StringOf("operations[i].name")
    ENDIF

NEXT

n := oJsonOut:SizeOfArray("imageFormats.output")
FOR i := 0 TO n - 1
    oJsonOut:I := i
    ? "image format: " + oJsonOut:StringOf("imageFormats.output[i]")
NEXT

? "default timeout: " + Str(oJsonOut:IntOf("limits.timeoutMs.default")) + " ms"
? "default largest image: " + Str(oJsonOut: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

oJson:destroy()
oFmt:destroy()
oJsonOut:destroy()