⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas.~1~

📁 Delphi 2005程序设计教程_实例源文件和教学课件
💻 ~1~
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls, System.ComponentModel, IdBaseComponent, IdComponent,
  IdTCPConnection, IdTCPClient, IdHTTP;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Memo1: TMemo;
    IdHTTP1: TIdHTTP;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    ComboBox3: TComboBox;
    Label3: TLabel;
    procedure ComboBox2Change(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation


{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  source:TMemoryStream;
  response:TStringStream;
begin
  if Combobox1.Items.IndexOf(ComboBox1.text)=-1 then
    ComboBox1.Items.Add(ComboBox1.Text);
  try
    Memo1.Clear ;
    case ComboBox3.ItemIndex of
    0:
      Begin
        IdHTTP1.Head(ComboBox1.Text);
        Memo1.Lines.Add('Content-Type:'+IdHTTP1.Response.ContentType);
        Memo1.Lines.Add('Date:'+DateToStr(IdHTTP1.Response.Date));
      end;
    1: 
      Begin
        Memo1.Lines.Text:=ComboBox1.Text;
      end;
    end;
  finally
    IdHTTP1.Free;
  end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  try
    ComboBox1.Items.SaveToFile(ExtractFilePath(ParamStr(0))+'url.dat');
  except
  end;
end;

procedure TForm1.ComboBox2Change(Sender: TObject);
begin
  case ComboBox2.ItemIndex of
    0: IdHTTP1.ProtocolVersion :=pv1_0;
    1: IdHTTP1.ProtocolVersion :=pv1_1;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -