Home > Back-end >  Small white help web browsing after capture images
Small white help web browsing after capture images

Time:10-13

Do you want to be a source code to extract the image from the website address, and then browse the software; But I don't know how to implement on one piece, the effect of the next, specific code is as follows:
The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls IdBaseComponent, IdComponent IdTCPConnection,
IdTCPClient IdHTTP, ExtCtrls GIFImage;

Const
Num=35;

Type
TForm1=class (TForm)
IdHTTP1: TIdHTTP;
Image1: TImage;
Procedure FormCreate (Sender: TObject);


Private
{Private declarations}
Public
{Public declarations}
The end;

Var
Form1: TForm1;
IMS: TMemoryStream;
I, j: integer;
K: integer=35;//to extract the total 35 pictures address
TMP, url: String;
Gif: TGIFImage;
The function SplitPicUrl (LeftStr, RightStr, Data: string) : TStringList;


Implementation

{$R *. DFM}

Procedure TForm1. FormCreate (Sender: TObject);
The begin
IdHTTP1:=TIdHTTP. Create (nil);
TMP:=IdHTTP1. Get (" http://www.weather.com.cn/html/radar/JC_RADAR_AZ9398_JB.shtml ");
Url:=SplitPicUrl (' & lt; The option value="', '" selected=" selected "& gt; ', TMP) [k].//read the first k + 1 picture of address and write the url
IMS:=TMemoryStream. Create;
IdHTTP1. Get (url, IMS);
Image1. Picture. Assign (nil);
Gif:=TGIFImage. Create;
IMS. Position:=0;
Gif. LoadFromStream (IMS);
Image1. Picture. Assign (Gif);
IMS. Free;
Gif. Free;
IdHTTP1. Free;
The end;

The function SplitPicUrl (LeftStr, RightStr, Data: string) : TStringList;//the Data between LeftStr and RightStr intercept all of the characters of
Var
I, j, k: integer;
TMP: string;
The begin
Result:=TStringList. Create;

For k:=0 to 35 do 35 images were extracted//address
The begin
I:=pos (LeftStr, Data);
J:=pos (RightStr, Data);
TMP:=copy (Data, I + Length (LeftStr), j - I - Length (LeftStr));
Result. The Add (TMP);
Delete (Data, 1, j - 1 + Length (RightStr));
The end;

The end;

End.

Program can show the current site the latest pictures,
But want to add two buttons on one piece, the next and real-time update latest pictures, is in a hurry!

Small white one, a variety of online search also can not find a solution, can only hope that you all a great god!! Thank humbly!

CodePudding user response:

Why so trouble, have a ready-made controls, with EmbeddedWB can easily save all the pictures on the web,
  • Related