Version:0.9 StartHTML:0000000105 EndHTML:0000154574 StartFragment:0000000141 EndFragment:0000154538
Program QR_Code5_Direct_Indy10_Wininet_11_Code5_V211_8;
//#sign User: DESKTOP-BTLKHKF: 23/01/2024 20:04:32 
//#path:ples\C:\maxbox\maxbox5\examples\xamples\r2\restunits\Indy9\maxbox5\maxbox5\examples\
//TODO: Save the QRCode to webserver_file, EEdition, #locs:350
//http://theroadtodelphi.wordpress.com/2010/12/06/generating-qr-codes-with-delphi/
{Purpose: shows in 7 ways how to get a QRCode}
                               
Const
 URLGoogleQRCODE='https://chart.apis.google.com/chart?chs=%dx%d&cht=qr&chld=%s&chl=%s';
   AFILENAME= 'mX5QRCode5.png';
   //QDATA= 'this is maXland on a stream dream firebox';
   // QDATA= 'http://www.blaisepascal.eu/';
    QDATA= 'https://maxbox4.wordpress.com/';
Type TQrImage_ErrCorrLevel=(L,M,Q,H);
   
{The API requires 3 simple fields be posted to it:
cht=qr this tells Google to create a QR code;
chld=M the error correction level of the QR code (see here for more info);
chs=wxh the width and height of the image to return (eg chs=250x250);
chl=text the URL encoded text to be inserted into the barcode.}

//1. WinInet -Win API
procedure GetQrCodeInet(Width,Height:Word; C_Level,apath:string;const Data:string);
var encodURL: string;
    pngStream: TMemoryStream;
begin
  encodURL:= Format(URLGoogleQRCODE,[Width,Height, C_Level, HTTPEncode(Data)]);
  pngStream:= TMemoryStream.create;
  HttpGet(encodURL, pngStream);   //WinInet
  {with TLinearBitmap.Create do try
    //LoadFromStream2(pngStream,'PNG');
    //SaveToFile(apath);  }
  try  
    pngStream
.Position:= 0;
    pngStream.savetofile(apath);
    sleep(500);
    OpenDoc(apath);
  finally
    //Dispose; 
    pngStream.Free;
  end;
end;
//2. Indy 10 Socks Lib -GoogleAPI
procedure GetQrCodeIndy(Width,Height: Word; C_Level,apath: string; const Data: string);
var encodURL: string;
    idhttp: TIdHttp;// THTTPSend;
    pngStream: TMemoryStream;
begin
  encodURL:= Format(URLGoogleQRCODE,[Width,Height,C_Level, HTTPEncode(Data)]);
  idHTTP:= TIdHTTP.Create(NIL)
  pngStream:= TMemoryStream.create;
  idHTTP.Get1(encodURL, pngStream)  
  
//writeln(idHTTP.Get(encodURL)); 
    //Exception: if not Dll-Could not load SSL library. at 827.447
   try 
    pngStream
.Position:= 0;
    writeln(itoa(pngStream.size));
    pngStream.savetofile(apath);
    sleep(500);
    OpenDoc(apath);
  finally
    idHTTP.Free
    idHTTP
:= Nil;
    pngStream.Free;
  end;
end;
//3. Internal mXLib5  -GoogleAPICode
procedure getQRCodeDirect;
begin
  //GetQrCode3(250,250,'Q',QDATA, ExePath+AFILENAME);
  GetQrCode5(296,296,'Q',QDATA, ExePath+AFILENAME);
  //OpenDoc(ExePath+AFILENAME);
end;  
//4. Internal Class mXLib5 -GoogleAPI
procedure GetQrCodeWininetClass(Wid,Hei:Word; C_Level,apath:string; const Data:string);
var httpR: THttpConnectionWinInet;
    ms: TMemoryStream;   
    heads
: TStrings; iht:IHttpConnection; //losthost: THTTPConnectionLostEvent;
begin
  httpr:= THttpConnectionWinInet.Create(true); 
  ms
:= TMemoryStream.create;
  try 
    
//iht:= httpRq.setHeaders(heads);
    httpR.Get(Format(URLGoogleQRCODE,[Wid,Hei,C_Level,HTTPEncode(Data)]),ms);
    //httpRq.setRequestheader('x-key',aAPIkey); 
    if httpr.getresponsecode=200 Then begin
      ms.Position:= 0;
      ms.savetofile(apath);
      sleep(500);
      OpenDoc(apath)
    end Else writeln('Failed responsecode:'+
                                   itoa(HttpR.getresponsecode));
  except  
    
//writeln('Error: '+HttpRq.GetResponseHeader(''));
    writeln('EHTTP: '+ExceptiontoString(exceptiontype, exceptionparam));       
  
finally
    httpr:= Nil;
    ms.Free;
  end;                  
end;                              //}


//5. Internal QR-Component mXLib5 -internal APICalc
const COLORONCOLOR = 3;
procedure QRCcode(apath:string; atext: string);
var aQRCode: TDelphiZXingQRCode; QRCodBmp: TBitmap; Jpg: TJpegImage;
    Row,Column,err: Integer; res: Boolean; //HRESULT;
    var form1: TForm;
begin
  aQRCode:= TDelphiZXingQRCode.Create;
  QRCodBmp:= TBitmap.Create;
  form1:= getform2(700,500,123,'QR Draw PaintPerformPlatform PPP5');
  try
    aQRCode.Data:= atext;
    aQRCode.Encoding:= qrcAuto; //TQRCodeEncoding(cmbEncoding.ItemIndex);
    //aQRCode.QuietZone := StrToIntDef(edtQuietZone.Text, 4);
    QRCodBmp.SetSize(aQRCode.Rows, aQRCode.Columns);
    for Row:= 0 to aQRCode.Rows- 1 do 
      
for Column:= 0 to aQRCode.Columns- 1 do begin
        if (aQRCode.IsBlack[Row, Column]) then 
          QRCodBmp
.Canvas.Pixels[Column,Row]:= clBlack
        
else  
          QRCodBmp
.Canvas.Pixels[Column,Row]:= clWhite;
      end;
    //Form1.Canvas.Brush.Bitmap := QRCodeBitmap;
    //Form1.Canvas.FillRect(Rect(407,407,200,200));
    SetStretchBltMode(form1.canvas.Handle, COLORONCOLOR);
   // note that you need to use the Canvas handle of the bitmap
   // QRCodeBitmap.transparent:= true;
   Res:= StretchBlt(
     form1.canvas.Handle,300,150,QRCodBmp.Width+250,QRCodBmp.Height+250,
     QRCodBmp.canvas.Handle, 1,1, QRCodBmp.Width, QRCodBmp.Height, SRCCOPY);
     form1.canvas.font.color:= clyellow;
     form1.canvas.TextOut(20,30,Format('QRCode of: %-40s ', [atext]));
     if not Res then begin
       err:= GetLastError;
       form1.Canvas.Brush.Color:= clyellow;
       form1.canvas.TextOut(20,20,Format('LastError: %d %s', 
                                            
[err, SysErrorMessage(err)]));
     end;
  finally
    aQRCode.Free;
    QRCodBmp.Width:= QRCodBmp.Width+250;
    QRCodBmp.Height:= QRCodBmp.Height+250;
    QRCodBmp.Canvas.StretchDraw(Rect(0, 0, QRCodBmp.Width+2000, 
                                           QRCodBmp
.Height+2000), QRCodBmp);
    //QRCodBmp.savetofile(apath)
    Jpg := TJpegImage.Create;
    Jpg.Assign( QRCodBmp );
    Jpg.SaveToFile( apath );
    openfile(apath)
    Form1.Canvas.Brush.Bitmap:= Nil;
     {azuSaveForm( form1, Exepath+'examples\1130_mondrian_QRCode51.bmp');
     azuSaveJPEGPictureFile(QRCodBmp, 
              Exepath+'\examples\', '1130_mondrian_QRCode511.jpg',400);   }
    QRCodBmp.Free;
    Jpg.free;
  end;
end;  
procedure getgimagetest(Sender: TObject);
var
  oXMLHTTP: OleVariant;
  MemStream: TMemoryStream;
  Stream: IStream;
  OleStream: TOleStream;
begin
  oXMLHTTP := CreateOleObject('MSXML2.XMLHTTP.3.0');
  oXMLHTTP.open('GET', 'https://www.google.com/images/srpr/logo11w.png', False);
  oXMLHTTP.send(NULL);
  
  MemStream
:= TMemoryStream.Create;
  try
  //MemStream:= getmemStreamfromIStream2file(oXMLHTTP.ResponseStream, 
    //                                           exepath+'logo11w2.png');
   memstream:= getmemStreamfromIStream2(oXMLHTTP.ResponseStream);  
                                              
 
{ Stream := IUnknown(oXMLHTTP.ResponseStream) as IStream; }
 { OleStream:= TOleStream.Create(Stream);
  try
    OleStream.Position:= 0;
   MemoryStream:= TMemoryStream.Create;
    try
      MemoryStream.CopyFrom(OleStream, OleStream.Size);
      MemStream.SaveToFile(exepath+'logo11w3.png');
      openfile(exepath+'logo11w3.png');
    finally
      MemoryStream.Free;
    end;    }
    openfile(exepath+'logo11w3.png');
  finally
    memStream.Free;
  end;
end;
//6. External Lib and external GoogleAPI
//https://stackoverflow.com/questions/15441014/how-do-i-load-an-istream-into-a-tmemorystream
// Use JSON for the REST API calls and set API KEY via Authorization header
function QRCcodeOle(Wid,Hei:Word; C_Level,apath:string; const Data:string): string;
var httpReq,hr: Olevariant;  instream: IStream;
    jo: TJSON; strm :TMemoryStream; 
begin  
  httpReq
:= CreateOleObject('WinHttp.WinHttpRequest.5.1');
  //jo:= TJSON.Create();
     hr:= httpReq.Open('GET',  
                       format
(URLGoogleQRCODE,[Wid,Hei,C_Level,HTTPEncode(Data)]))            
    httpReq
.setRequestheader('content-type','application/octet-stream'); 
    
//httpReq.setRequestheader('Authorization','Bearer '+ CHATGPT_APIKEY2);
    if hr= S_OK then 
         HttpReq
.Send();
    strm:= TMemoryStream.create;
    If HttpReq.Status = 200 Then begin
       try
         //https://stackoverflow.com/questions/4938601/getting-an-istream-from-an-olevariant
         strm:= getmemStreamfromIStream2(HttpReq.responsestream);
         //getmemStreamfromIStream2file(hrstream, apath);
         writeln('responsestream size: '+itoa(strm.size)); 
         strm
.savetoFile(apath)
         openFile(apath);  
       
except
         writeln('EHTTPex: '+ExceptiontoString(exceptiontype, exceptionparam));
       finally
         strm.free;
         httpreq:= unassigned; 
       
end;  
    
end;                
end;
///TPathInitializationEvent = procedure ( Sender : TObject; var Path : String ) of Object;
 procedure TPathInitialization( Sender : TObject; var Path : String ) ;
 begin
   writeln('get P4D path test: '+path)
 end; 
Const ULIMIT = '100000'; //  '100000000'; 
procedure PYdigitQRCode;
begin
  with TPythonEngine.Create(Nil) do begin
   pythonhome:= 'C:\Users\user\AppData\Local\Programs\Python\Python312\';
   //SetPythonHome; //pythonpath
   traceback;
    //EncodeString  //OnSysPathInit  /pyflags
   UseWindowsConsole:= false;
    //onafterinit
    OnPathInitialization:= @TPathInitialization;
   //https://steema.com/docs/teebi/lib/index.htm?BI.Plugins.Python.Engine.TPathInitializationEvent.htm
   try
     loadDLL;
     //opendll(PYDLL64)
     //execstr('from imageai.Detection import ObjectDetection');
     //execstr('from faker import Faker');
     execstr('import sys, os, json, qrcode');
     println(EvalStr('sys.version'));
     println(EvalStr('sys.executable'));
   { execstr('fake = Faker()');   }
    execstr('qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_Q)');
    execstr('qrcode.make("'+QDATA+'").save(".\examples\'+AFILENAME+'")');
     //println(EvalStr('fake.profile()'));   //}
     // println('is posix '+EvalStr('lib_platform.is_platform_posix'));
     execstr('step = lambda x: sum(int(d) ** 2 for d in str(x))');
     execstr('iterate = lambda x: x if x in [1, 89] else iterate(step(x))');
     Println('Sumup Python1test: '+ 
          EvalStr
('sum(1 for item in[iterate(x) for x in range(1,'+ULIMIT+')]if item==89)')); 
          
///}
   except
     raiseError; 
     
//clearengine;
   finally   
     unloaddll
;   
     free
;
   end; 
  
end; 
end;
procedure Inet_TimeSetDemo;
//run procedure in Admin mode to set sys time! 
begin 
  
with TIdSNTP.Create(self) do
  try
    Host:= '0.debian.pool.ntp.org'
    writeln('InternetTime: '+datetimetoStr(datetime));
    if Synctime then writeln('Op System Time sync now!');
  finally
    Speak('Your SysTime is now sync with Inet Time '
            +TimeToStr(datetime))
    Free;
  end   //}
end;  
//TODO:#1 Returns QR Code direct of last modification of the given File
begin  //@main
  Writeln(dateTimeToStr(FileTimeGMT(exepath+'maxbox5.exe')));
  setdebugcheck(true);
   maxform1.console1click(self);
   memo2.font.name:= 'courier';
   memo2.font.size:= 12;
  //GetQrCodeTest(150,150,'Q', 'this is maXland on the maXbox');
  //1. call of script with with WinInet
 { GetQrCodeInet(150,150,'Q',ExePath+'examples\'+AFILENAME,QData);
  sleep(500);
  writeln('SHA1 '+sha1(ExePath+'examples\'+AFILENAME));     //}
  //SHA1 FE526D46BA48DFD820276872C969473A7B7DE91C
  
  
//2. call of script with Indy10
  //Exception: Could not load SSL library. at 828.447
  
  
{GetQrCodeIndy(150,150,'Q',ExePath+AFILENAME, QData);
  sleep(500);
  writeln('SHA1 '+sha1(ExePath+AFILENAME));     // }
 
  
//3. call of the Internal Lib
 { GetQrCode5(150,150,'Q',QDATA, ExePath+AFILENAME);
  sleep(500);
  writeln('SHA1 '+sha1(ExePath+AFILENAME));   //}
    //getQRCodeDirect;
  //Inet_TimeSetDemo;
  
  
//4. call of the Wininet Class
 { GetQrCodeWininetClass(150,150,'Q',ExePath+AFILENAME, QDATA);
   writeln('SHA1 '+sha1(ExePath+AFILENAME));  //}
   
  
//5. Internal QR-Component mXLib5
  // QRCcode(ExePath+'examples\mX5QRCode5.jpg', QDATA);
  // writeln('SHA1 '+sha1(ExePath+'examples\mX5QRCode5.jpg'));
  
   
If isAdmin then Inet_TimeSetDemo;
   maxCalcF('SQRT(4296)');
   //PrintF('gcd %d * lcm %d = %d ',[gcd(4,6),lcm(4,6),4*6]);
    writeln(getcomputername)
    writeln(getmemInf)
   // getgimagetest(self);
    
    
//6. call of the OLE Variant Class WinHttp (late binding)
    writeln('result of OLE call: '+
                     QRCcodeOle(150,150,'Q',ExePath+'examples\'+AFILENAME, QDATA));
    writeln('SHA1: '+sha1(ExePath+'examples\'+AFILENAME));  //} 
    
    
////7. call of external Python4Delphi interpreter
   { PYdigitQRCode();
    writeln('SHA1: '+sha1(ExePath+'examples\'+AFILENAME));  
    openFile(ExePath+'examples\'+AFILENAME);                 //}
end.  

qrcode ref
: FE526D46BA48DFD820276872C969473A7B7DE91C
Doc
:  https://qreader.online/
http://theroadtodelphi.wordpress.com/2010/12/06/generating-qr-codes-with-delphi/
debug: 20-Could not load SSL library. 828 err:20
Exception: Could not load SSL library. at 828.447
Using the Google Chart Tools / Image Charts (aka Chart API) you can easily generate QR 
codes
, this kind of images are a special type of two-dimensional barcodes. They are 
also known 
as hardlinks or physical world hyperlinks.
The QR Codes store up to 4,296 alphanumeric characters of arbitrary text. QR codes can be read by an optical 
device 
with the appropriate software. Such devices range from dedicated QR code readers to mobile phones.
Using Delphi there are several ways you can generate QR codes - to encode any text 
(URL, phone number, simple message). 
QR Codes store up 
to 4,296 alphanumeric characters of arbitrary text.
The 2D Barcode VCL components is a set of components designed for generating and printing barcode symbols 
in your Delphi or C++ Builder applications. Use the components set like any other VCL components.
J4L Components includes the QR-code implementation featuring: auto, byte, alpha, numeric and kanji encoding.
The Google Chart Tools (Chart API) also let you generate QR-code images using an HTTP POST or 
All 
do you need to generate a QrCode is make a get request to this URI

http
://chart.apis.google.com/chart?chs=200x200&cht=qr&chld=M&chl=Go+Delphi+Go
uses
 PngImage,
 HTTPApp,
 WinInet;
 
type
TQrImage_ErrCorrLevel=(L,M,Q,H);
 
const
UrlGoogleQrCode='http://chart.apis.google.com/chart?chs=%dx%d&cht=qr&chld=%s&chl=%s';
QrImgCorrStr   : array [TQrImage_ErrCorrLevel] of string=('L','M','Q','H');
 
procedure WinInet_HttpGet(const Url: string;Stream:TStream);
const
BuffSize = 1024*1024;
var
  hInter   : HINTERNET;
  UrlHandle: HINTERNET;
  BytesRead: DWORD;
  Buffer   : Pointer;
begin
  hInter := InternetOpen('', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  if Assigned(hInter) then
  begin
    Stream.Seek(0,0);
    GetMem(Buffer,BuffSize);
    try
      UrlHandle:=InternetOpenUrl(hInter,PChar(Url),nil,0,INTERNET_FLAG_RELOAD,0);
        if Assigned(UrlHandle) then begin
          repeat
            InternetReadFile(UrlHandle, Buffer, BuffSize, BytesRead);
            if BytesRead>0 then
             Stream.WriteBuffer(Buffer^,BytesRead);
          until BytesRead = 0;
          InternetCloseHandle(UrlHandle);
        end;
    finally
      FreeMem(Buffer);
    end;
    InternetCloseHandle(hInter);
  end
end
;
 
//this function return a Stream (PngImage inside) with a Qr code.
procedure GetQrCode(Width,Height:Word;Correction_Level:TQrImage_ErrCorrLevel;
const Data:string;StreamImage : TMemoryStream);
Var
 encodURL  : string;
begin
  encodURL:=Format(UrlGoogleQrCode,[Width,Height,QrImgCorrStr[Correction_Level],HTTPEncode(Data)]);
  WinInet_HttpGet(encodURL,StreamImage);
end;
http://www.delphi-central.com/callback.aspx
 public
    { Public-Deklarationen }
    constructor Create(Owner:TComponent); override;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent);override;
    procedure DrawBarcode(Canvas:TCanvas);
    procedure DrawText(Canvas:TCanvas);
    property CanvasHeight :Integer read GetCanvasHeight;
    property CanvasWidth :Integer read GetCanvasWidth;
  published
    { Published-Deklarationen }
   { Height of Barcode (Pixel)}
    property Height : integer read FHeight write SetHeight;
    property Text   : string read FText write SetText;
    property Top    : Integer read FTop write SetTop;
    property Left   : Integer read FLeft write SetLeft;
   { Width of the smallest line in a Barcode }
    property Modul  : integer read FModul  write SetModul;
    property Ratio  : Double read FRatio write SetRatio;
    property Typ    : TBarcodeType read FTyp write SetTyp default bcCode_2_5_interleaved;
   { build CheckSum ? }
    property Checksum:boolean read FCheckSum write SetCheckSum default FALSE;
    property CheckSumMethod:TCheckSumMethod read FCheckSumMethod write FCheckSumMethod default csmModulo10;
   { 0 - 360 degree }
    property Angle  :double read FAngle write SetAngle;
    property ShowText:TBarcodeOption read FShowText write SetShowTxt default bcoNone;
    property ShowTextFont: TFont read FShowTextFont write SetShowTextFont;
    property ShowTextPosition: TShowTextPosition read FShowTextPosition write SetShowTextPosition 
    
default stpTopLeft;
    property Width : integer read GetWidth write SetWidth stored False;
    property Color:TColor read FColor write FColor default clWhite;
    property ColorBar:TColor read FColorBar write FColorBar default clBlack;
    property OnChange:TNotifyEvent read FOnChange write FOnChange;
  end;
function CheckSumModulo10(const data:string):string;
function ConvertMmToPixelsX(const Value:Double):Integer;
function ConvertMmToPixelsY(const Value:Double):Integer;
function ConvertInchToPixelsX(const Value:Double):Integer;
function ConvertInchToPixelsY(const Value:Double):Integer;
TTarArchive Usage
-----------------
-
 Choose a constructor
- Make an instance of TTarArchive                  TA := TTarArchive.Create (Filename);
-
 Scan through the archive                         TA.Reset;
                                                   WHILE TA.FindNext (DirRec) DO BEGIN
- Evaluate the DirRec for each file                  ListBox.Items.Add (DirRec.Name);
-
 Read out the current file                          TA.ReadFile (DestFilename);
  (You can ommit this if you want to
  read in the directory only)                        END;
-
 You're done                                      TA.Free;

TTarWriter Usage
----------------
-
 Choose a constructor
- Make an instance of TTarWriter                   TW := TTarWriter.Create ('my.tar');
-
 Add a file to the tar archive                    TW.AddFile ('foobar.txt');
-
 Add a string as a file                           TW.AddString (SL.Text, 'joe.txt', Now);
-
 Destroy TarWriter instance                       TW.Free;
-
 Now your tar file is ready.
The last slash might be optional. Right?
How about something like this:
$url =~ m|([^/]+)/?$|;
my $end_of_url = $1;
The $ on the end anchors the regular expression to the end of the string. The [^/] means 
anything that
's not a slash and the + after means I want one or more things that are not 
slashes. Notice that this is in a capture group which are marked with parentheses.
end the regular expression with /? which means that there may or may not be a slash 
on the very end of the string. I've put my regular expression between m| and |, so I 
can use forward slashes without having to constantly escape them.
The last part of the URL is now in $1 and I can set my own scalar variable to save this Result.
share|improve this answer

  
procedure GetQrCodeImage(Width,Height: Word; Correct_Level: string;
           const Data:string; aimage: TImage; apath: string);
var
  encodURL: string;
  idhttp: TIdHttp;// THTTPSend;
  pngStream: TMemoryStream;
begin
  encodURL:= Format(UrlGoogleQrCode,[Width,Height, Correct_Level, HTTPEncode(Data)]);
  //WinInet_HttpGet(encodURL,StreamImage);
  idHTTP:= TIdHTTP.Create(NIL)
  pngStream:= TMemoryStream.create;
  with TLinearBitmap.Create do try
    idHTTP.Get1(encodURL, pngStream)
    pngStream.Position:= 0;
    LoadFromStream2(pngStream,'PNG');
    aImage.Picture:= NIL;
    AssignTo(aimage.picture.bitmap);
    SaveToFile(apath);
    //OpenDoc(apath);
  finally
    Dispose;
    Free;
    idHTTP.Free
    pngStream
.Free;
  end;
end;
procedure GetQrCode3(Width,Height: Word; Correct_Level: string;
           const Data:string; apath: string);
var
  encodURL: string;
  idhttp: TIdHttp;// THTTPSend;
  png: TLinearBitmap;//TPNGObject;
  pngStream: TMemoryStream;
begin
  encodURL:= Format(UrlGoogleQrCode,[Width,Height, Correct_Level, HTTPEncode(Data)]);
  //WinInet_HttpGet(encodURL,StreamImage);
  idHTTP:= TIdHTTP.Create(NIL)
  pngStream:= TMemoryStream.create;
  with TLinearBitmap.Create do try
    idHTTP.Get1(encodURL, pngStream)
    pngStream.Position:= 0;
    LoadFromStream2(pngStream,'PNG');
    //aImage.Picture:= NIL;
    //AssignTo(aimage.picture.bitmap);
    SaveToFile(apath);
    OpenDoc(apath);
  finally
    Dispose;
    Free;
    idHTTP.Free
    pngStream
.Free;
  end;
end;

procedure CreateMyFastForm;
 //diaform:= CreateMessageDialog('my fast form perform',mtconfirmation, []);
var //dbform: TForm;
    ard: TRadioGroup;
    //mimg: TImage;
begin
   dbform:= CreateMessageDialog('My Fast Form Template - FFP',mtwarning,
                                        [mball, mbyes, mbhelp, mbok]);
   with dbform do begin
     font.size:= 12;
     caption:= 'FFP XML Demo';
     setBounds(50,50,800,600)
     FormStyle:= fsStayontop;
     //Color:= 12234;  //clWebGold;//12234;
     autoScroll:= true;
   with TLabel.Create(self) do begin
     parent:= dbform;
     SetBounds(400,60,500,600)
     font.size:= 18;
     //dblist.Add('All Converted to...XML')
     caption:= 'QRCode in a Stream Dream...';
   end;  
   
with TRadioGroup.Create(self) do begin
     parent:= dbform;
     top:= 90;
     left:= 60;
     items.add('first entry of');
     items.add('second entry off');
     items.add('third entry off');
     ItemIndex:= 2; 
     
//writeln(Items.Strings[ItemIndex]); 
   end;
  with TBitBtn.Create(self) do begin
    Parent:= dbform;
    setbounds(570, 490,190, 40);
    caption:= 'File to Barcode';
    font.size:= 12;
    glyph.LoadFromResourceName(getHINSTANCE,'TASBARCODE'); 
    
//onclick:= @GetMediaData2;
  end;
  with TBitBtn.Create(self) do begin
    Parent:= dbform;
    setbounds(570, 320,190, 150);
    caption:= 'File to Barcode';
    font.size:= 12;
    glyph.LoadFromResourceName(getHINSTANCE,'JVGAMMAPANELCOLORS'); 
    
//onclick:= @GetMediaData2;
  end;
   Show;
   Canvas.Draw(400,120,getBitMap(Exepath+'\examples\citymax.bmp'));
  FImage:= TImage.create(self);
  with FImage do begin
   parent:= dbform;
   setbounds(50,210,150,150)
  end; 

  
with Barcode1 do begin
    Top := 400;
    Left := 50;
    Height:= 130;
    //Barcode1.Width:= 230;
    //barcode1.assign
    //Barcode1.Angle := 70;
    Typ := bcCode_2_5_interleaved;
    Showtext:= bcoBoth;
    text:= '0123456789';
    DrawBarcode(Canvas);
    Typ := bcCodeEAN128C; //bcCode_2_5_interleaved;
    Left:= 180;
    text:= '0123456789';
    DrawBarcode(Canvas);
    Typ := bcCode128C; //bcCodePostNet; //,bcCodeEAN128C; //bcCode_2_5_interleaved;
    Left:= 320;
    text:= '0123456789';
    DrawBarcode(Canvas);
   end;
    //Barcode1.DrawText(dbform.Canvas);  
  end; //dbform
   //SelectDirectory
end;
After the error occurs, you can call Indy's WhichFailedToLoad() function in the 
IdSSLOpenSSLHeaders unit to find out WHY Indy wasn't able to load the SSL library. 
But most likely, you are simply using the wrong version of the DLLs. 
TIdSSLIOHandlerSocketOpenSSL supports only up 
to OpenSSL 1.0.2u, which you can get 
from Indy
's OpenSSL Binaries repo on GitHub. If you want to use OpenSSL 1.1.x+ with 
Indy, you will have to use this SSLIOHandler instead (note: work-in-progress), 
or alternatively you can use sgcIndy.
function TRestClient3_Pixapay(askstream, imagetype: string; 
                                  responseHeader
:TRestResponseHandler): string;
var JPostdat: string; urlid: TIduri;
    jo: TJSON; rest: TRestResource;
begin
  JPostDat:= '{'+
    '"ask": "%s",'+
    '"content": "%s",'+
    '"style": 0.15}';
   with TRestClient.create(self) do begin
     urlid:= TIdURI.create('');
     rest:= Resource(urlid.URLEncode(Format(URLPIXABAY,[askstream,imagetype])));
     println('@addr:'+objtostr(rest))
     rest.ContentType('application/json');
     rest.header('User-Agent',UAGENT);
     rest.accept('application/json,text/plain; q=0.9, text/html;q=0.8');
     ConnectionType:= hctWinInet;
     OnafterRequest:= @TRestOnRequestEvent2;
     OnResponse:= @TRestOnResponseEvent2;
    try
      jo:= TJSON.Create(); 
      jo
.parse(rest.Get()); 
      writeln
('return total hits: '+jo.values['totalhits'].asstring)
      result:=jo.values['hits'].asarray[randomrange(1,20)].asobject['webformatURL'].asstring;
    finally
      Free;
      jo.Free;
      urlid.Free;
    except  
      writeln
('EWI_Exc:'+ExceptiontoString(exceptiontype,exceptionparam));
    end; 
  
end; //with   
end; 

  
----app_template_loaded_code----