Delphi7 安装ICS,与简单使用
2020-02-15 23:48
459 查看
下载 OverbyteIcsV816 完成后解压到E:\Delphi7\OverbyteIcsV816\
1、在library里加入E:\Delphi7\OverbyteIcsV816\Source目录。
2、从File->Open中打开E:\Delphi7\OverbyteIcsV816\Install\D7Install.bpg文件。(文件名在其它Delphi版本略有不同)
3、在项目管理器中,右键OverbyteIcsD7Design.bpl选择Build和Install---要把BPL输出目录也加入 1、在library里
64位系统
4、将D:\软件\Delphi777777\bpl\OverbyteIcsD7Design.bpl
D:\软件\Delphi777777\bpl\OverbyteIcsD7Run.bpl
拷贝到 C:\Windows\SysWOW64下
5、E:\Delphi7\OverbyteIcsV816\Packages\OverbyteIcsD7Design.dpk可视化组件
就安装完成了!
uses OverbyteIcsHttpProt;
//单个网址,返回网页源代码
function HttpGet(const Url: string; var Html: string): Boolean; var HttpClient: THttpCli; DataLen: Int64; FailMsg: string; begin Result := False; HttpClient := THttpCli.Create(nil); HttpClient.URL := Url; HttpClient.NoCache := True; HttpClient.RcvdStream := TMemoryStream.Create; try try HttpClient.Get; DataLen := HttpClient.RcvdStream.Size; SetLength(Html, DataLen); HttpClient.RcvdStream.Position := 0; HttpClient.RcvdStream.Read(PChar(Html)^, DataLen); Result := True; except on E: EHttpException do begin FailMsg := Format('Failed : %d %s', [HttpClient.StatusCode, HttpClient.ReasonPhrase]); end else raise; end; finally HttpClient.RcvdStream.Free; HttpClient.RcvdStream := nil; HttpClient.Free; end; end;
uses OverbyteIcsHttpProt;
//用一个THttpCli访问多个网址,以节省资源,返回网页源代码
procedure TForm1.Button1Click(Sender: TObject);var aURL,aHtml:string;
i:Integer; var HttpClient:THttpCli; DataLen: Int64; var StartTime: Longword; Duration: integer; begin i:=1; HttpClient := THttpCli.Create(nil); HttpClient.NoCache := True; StartTime := GetTickCount; while i<1100 do begin // aURL:= 'http://chengyu.t086.com/cy0/'+inttostr(i)+'.html'; aURL:='http://chengyu.t086.com/cy0/'+inttostr(i)+'.html'; HttpClient.URL := aURL; HttpClient.RcvdStream := TMemoryStream.Create; try HttpClient.Get; DataLen := HttpClient.RcvdStream.Size; SetLength(aHtml, DataLen); HttpClient.RcvdStream.Position := 0; HttpClient.RcvdStream.Read(PChar(aHtml)^, DataLen); ParserHtmlSaveToSQlite(aHtml); Memo1.Lines.Add(aURL); Button1.Caption:=IntToStr(i); HttpClient.RcvdStream.Free; HttpClient.RcvdStream := nil; i:=i+1; except HttpClient.RcvdStream.Free; HttpClient.RcvdStream := nil; i:=i+1; end; end; Duration := GetTickCount - StartTime; Label1.Caption := IntToStr(Duration div 1000) + ' 秒'; HttpClient.Free; end;
uses OverbyteIcsHttpProt;
//读取网页上的多张图片,并保存在 程序文件夹内 procedure TForm1.Button1Click(Sender: TObject); var aURL,aHtml:string; i:Integer; var HttpClient: THttpCli; DataLen: Int64; var StartTime: Longword; Duration: integer; begin i:=1; HttpClient := THttpCli.Create(nil); HttpClient.NoCache := True; StartTime := GetTickCount; while i<59 do begin aURL:='http://img1.mm131.com/pic/2408/'+inttostr(i)+'.jpg'; HttpClient.URL := aURL; // HttpClient.RcvdStream := TMemoryStream.Create; HttpClient.RcvdStream := TFileStream.Create(inttostr(i)+'.jpg', fmCreate); try HttpClient.Get; Memo1.Lines.Add(aURL); Button1.Caption:=IntToStr(i); HttpClient.RcvdStream.Free; HttpClient.RcvdStream := nil; i:=i+1; except HttpClient.RcvdStream.Free; HttpClient.RcvdStream := nil; i:=i+1; end; end; Duration := GetTickCount - StartTime; Label1.Caption := IntToStr(Duration div 1000) + ' 秒'; HttpClient.Free; end;
转载于:https://www.cnblogs.com/tulater/p/6155387.html
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- Delphi 拦截滚轮事件不响应滚轮的上下滚动
- Delphi Live Bindings 初探
- 重装Delphi10.2的IDE必要设置
- Delphi7 GDI+学习
- delphi7 TRichView 安装
- DELPHI常用函数集及简要范例
- Delphi: 如何减小应用程序(EXE)的大小?
- Delphi中建议使用的语句
- delphi使用SQL的教程8
- Delphi中本年、本月、本周第一天和最后一天
- delphi xml 添加节点
- delphi xml 查找节点
- delphi 中 Record ,packet Record
- Delphi的MessageBox的用法
- Delphi 将DBGrid中的内容导出到Excel
- Delphi把窗体设为bsnone时如何拖动窗体
- Delphi向QQ2011窗口发送登录消息
- delphi编程中的棘手问题;求指教!
- 在DELPHI程序中自动设置ODBC数据源
- Delphi粗边框