CPC 464 Game Images lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Gigatron · 2025-03-09 16:29 Hi, A few weeks ago I had started a project to train on the programming www on Lazarus pascal; The goal is to download for an image on the net and display it. So here is this little project. Cpc464 was my first computer and i like it ; The Base web-site is : https://www.cpc-power.com/ You must download this ssl library and put all files to the project drawer: https://wiki.overbyte.eu/arch/openssl-1.1.1w-win64.zip ** Edit : If I have time the next version will be better, extract the title in the HTML code etc... Code: Pascal [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1;{$mode objfpc}{$H+}interfaceuses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Spin, BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes, OpenSSLSockets, fphttpclient; type { TForm1 } TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Label2: TLabel; Panel1: TPanel; SpinEdit1: TSpinEdit; SpinEdit2: TSpinEdit; VirtualScreen: TBGRAVirtualScreen; procedure BGRAVirtualScreenRedraw(Sender: TObject; Bitmap: TBGRABitmap); procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private FBitmap: TBGRABitmap; public end; var Form1: TForm1; img_num, img_slot, mono: integer; HttpClient: TFPHTTPClient; MemStream: TMemoryStream; ImageURL , ImageWWW : string; implementation{$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin FBitmap := nil; img_num := SpinEdit1.value; img_slot := SpinEdit2.value; mono := 1; // 1 = set ; 0 = unset(color);end; procedure TForm1.BGRAVirtualScreenRedraw(Sender: TObject; Bitmap: TBGRABitmap);begin Bitmap.Fill(BGRAWhite); if Assigned(FBitmap) then begin bitmap.StretchPutImage(rect(0,0,320*2,256*2),Fbitmap,dmSet); end;end; procedure TForm1.Button1Click(Sender: TObject); begin if Assigned(FBitmap) then begin FBitmap.Free; FBitmap := nil; end; Imagewww := 'https://www.cpc- power.com/extra_lire_fichier.php?extra=cpcold&fiche='; ImageURL := Im agewww+inttostr(img_num)+'&slot='+inttostr(img_slot)+'&part=A&type=.pn g&green='+inttoStr(mono)+''; img_num := SpinEdit1.value; img_slot := SpinEdit2.value; HttpClient := TFPHTTPClient.Create(nil); MemStream := TMemoryStream.Create; try try HttpClient.Get(ImageURL, MemStream); MemStream.Position := 0; FBitmap := TBGRABitmap.Create(MemStream); VirtualScreen.DiscardBitmap; VirtualScreen.RedrawBitmap; except on E: Exception do ShowMessage('Erreur de téléchargement: ' + E.Message); end; finally HttpClient.Free; MemStream.Free; end; Label1.Caption:= 'Image Number : '+ IntToStr(img_num); Label2.Caption:= 'Image Slot : '+ IntToStr(img_slot); end; end. ---------------------------------------------------------------------- Gigatron · 2025-03-10 16:28 Hi This project become interesting, maybe usefull for you. Added Monochrome color, favorite list , and simple code ; Code: Pascal [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1;{$mode objfpc}{$H+}interfaceuses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Spin, BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes, OpenSSLSockets, fphttpclient, RegExpr; type { TForm1 } TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Label1: TLabel; Label2: TLabel; Label3: TLabel; ListBox1: TListBox; Panel1: TPanel; RadioButton1: TRadioButton; RadioButton2: TRadioButton; SpinEdit1: TSpinEdit; SpinEdit2: TSpinEdit; VirtualScreen: TBGRAVirtualScreen; procedure BGRAVirtualScreenRedraw(Sender: TObject; Bitmap: TBGRABitmap); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure ListBox1SelectionChange(Sender: TObject; User: boolean); procedure RadioButton1Change(Sender: TObject); procedure RadioButton2Change(Sender: TObject); private FBitmap: TBGRABitmap; public end; var Form1: TForm1; img_num, img_slot, mono: integer; HttpClient: TFPHTTPClient; MemStream: TMemoryStream; ImageURL , ImageWWW, GameTitle : string; implementation{$R *.lfm} function GetGameTitle(const URL: string): string;var HttpClient: TFPHTTPClient; PageSource: TStringList; Regex: TRegExpr; RawTitle: string;begin Result := 'Title Not Found '; HttpClient := TFPHTTPClient.Create(nil); PageSource := TStringList.Create; Regex := TRegExpr.Create; try try // HTML PageSource.Text := HttpClient.Get(URL); Regex.Expression := '