Question

I am preparing an application. IDHTTP: Using the Get method. But there are some problems. I want to create a list of Proxy and click listbox items (Proxy address) IDHTTP added. Sorry i little know English.

My codes;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if CheckBox1.Checked then
begin
LabeledEdit1.Enabled:= true;
LabeledEdit2.Enabled:= true;
IdHTTP1.ProxyParams.ProxyServer:=LabeledEdit1.Text;
IdHTTP1.ProxyParams.ProxyPort:=StrToInt(LabeledEdit2.Text);

CheckBox1.Caption:='Kendi IP adresimi kullan.';

 end
 else
begin

LabeledEdit1.Enabled:= false;
LabeledEdit2.Enabled:= false;
IdHTTP1.ProxyParams.ProxyServer:='';
IdHTTP1.ProxyParams.ProxyPort:=StrToInt('0');

CheckBox1.Caption:='Proxy kullan.';

end;
end;

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
IdHTTP1.Get(Edit1.Text);
MessageDlg('Mission complated.', mtinformation,[mbOK],0);
end;

I want;

I add Listbox1 Proxy.. Later.. Click Listbox1 item. Later.. BitBtn2 click.

Thanks.

Was it helpful?

Solution

Listbox1.Items.Add('1.1.x.2.1:80');
Listbox1.Items.Add('1.2.x.x.5:60');
...

.

procedure TForm1.Listbox1Click(Sender: TObject); 
var
  I: Integer;
  S: String;
begin 
  I := Listbox1.ItemIndex;
  if I <> -1 then
  begin 
    S := Listbox1.Items[I];
    IdHTTP1.ProxyParams.ProxyServer := Fetch(S, ':'); 
    IdHTTP1.ProxyParams.ProxyPort := StrToInt(S); 
  end 
  else 
  begin 
    IdHTTP1.ProxyParams.ProxyServer := ''; 
    IdHTTP1.ProxyParams.ProxyPort := 0; 
  end; 
end; 

.

procedure TForm1.BitBtn2Click(Sender: TObject);        
begin        
  IdHTTP1.Get(Edit1.Text);        
  MessageDlg('Mission complated.', mtinformation,[mbOK],0);        
end;      
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top