>Creating QR Codes with VFP via Google Chart Tools

>Google Chart Tools has a lot of useful service.

Now we are creating QR Code with VFP codes with this tool


*!* Author : Luis Maria Guayan
** Este seria el contenido de informacion del QR
lcDato =[?re=XAXX010101000%26rr=XAXX010101000%26tt=1234567890.123456] + ;
[%26id=ad662d33-6934-459c-a128-BDf0393f0f44]
** Ancho x Alto
lcDimensiones = ‘300×300’
** Donde quieren guardar la imagen, ojo, es PNG
lcImagen = PUTFILE(‘QRCode’,’QRCode’,’png’)

IF EMPTY(lcImagen)
RETURN
ENDIF

IF GoogleQR(lcDato,lcDimensiones,lcImagen) == 0
MESSAGEBOX(‘Descarga Exitosa’,0+64,’GoogleQR’)
ELSE
MESSAGEBOX(‘Error en la generacion del Codigo QR’,0+16,’GoogleQR’)
ENDIF

FUNCTION GoogleQR(pDato,pDimensiones,pImagen)
WAIT WINDOW “Generando y descargando Código QR, espere por favor…” NOWAIT
DECLARE LONG URLDownloadToFile IN “urlmon”;
LONG pCaller,;
STRING szURL,;
STRING szFileName,;
LONG dwReserved,;
LONG lpfnCB
sURL =”https://chart.googleapis.com/chart?cht=qr&chs=” + ;
pDimensiones + “&chld=Q&chl=” + STRTRAN(pDato,’&’,’%26′)
nRetVal = URLDownloadToFile (0, sURL, pImagen, 0, 0)
WAIT CLEAR
RETURN nRetVal
ENDFUNC

thanks to Luis and Google 🙂

Advertisements

5 thoughts on “>Creating QR Codes with VFP via Google Chart Tools

  1. Cool concept but I get the following error when I run the above code:

    * —————————
    GoogleQR
    —————————
    Error en la generacion del Codigo QR
    —————————
    OK
    —————————

  2. The issue was an incorrect character in the lcDimensiones assignment: simply replace ‘×’ (character 215) with ‘x’ (character 120) in the code above.

    Enjoy!

  3. Hi,
    Where in the code, I do not find an x (or chr215)?
    Arvid

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s