Visual FoxPro Requires Chilkat v11.7.0+
;S:;P:;; and offer to join the network. T is WPA (also used for WPA2 and WPA3), WEP, or nopass for an open network, and H:true can be added for a hidden network. In the name and the password, the characters backslash, semicolon, comma, colon and double quote must each be preceded by a backslash.
Visual FoxPro
Create a Wi-Fi QR Code
See more QR Code Examples
Demonstrates a QR code that joins a phone to a Wi-Fi network when scanned. A QR code only holds text. Phones recognize text of the form WIFI:T:Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loJson
LOCAL loFmt
LOCAL loJsonOut
lnSuccess = 0
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("payload.text","WIFI:T:WPA;S:Chilkat Guest;P:correct-horse-battery-staple;;")
* Level Q, so that the code still scans when it is printed small or gets worn.
loJson.UpdateString("encoding.qr.errorCorrection","Q")
loJson.UpdateInt("render.moduleSize",8)
* Say which network it is under the code.
loJson.UpdateBool("render.text.enabled",1)
loJson.UpdateString("render.text.value","Wi-Fi: Chilkat Guest")
loJson.UpdateInt("render.text.scale",2)
loJson.UpdateString("output.path","qa_output/qr_wifi.png")
loJson.UpdateBool("output.overwrite",1)
loJson.UpdateString("output.return","none")
loFmt = CreateObject('Chilkat.Formats')
loJsonOut = CreateObject('Chilkat.JsonObject')
lnSuccess = loFmt.QrCode("generate",loJson,loJsonOut)
IF (lnSuccess = 0) THEN
? loFmt.LastErrorText
RELEASE loJson
RELEASE loFmt
RELEASE loJsonOut
CANCEL
ENDIF
? "file: " + loJsonOut.StringOf("outputs[0].path")
? "QR version: " + STR(loJsonOut.IntOf("symbols[0].selectedEncoding.version"))
? "image: " + STR(loJsonOut.IntOf("outputs[0].width")) + " x " + STR(loJsonOut.IntOf("outputs[0].height")) + " pixels"
* The image written to qa_output/qr_wifi.png:
*
* Sample output:
* file: qa_output/qr_wifi.png
* QR version: 5
* image: 360 x 374 pixels
RELEASE loJson
RELEASE loFmt
RELEASE loJsonOut