Post method with idhttp without crashing

1
Hello, I'm going to explain more or less what I want to do, I have some data that needs to be sent by the post method to a server, however whenever I send the "freeza" program, I I have several data daily that need to be sent and in case I would like to use the code in a timer, and whenever the server response gets it jump to the next line.

var
S: TStringList;
M: TStream;
pega : string;
begin
 S := TStringList.Create;
 M := TMemoryStream.Create;

 pega := Listaimportados.Items[i];
 Inc(i);
 nome.text := Copy(pega, 0, 16);
 sobrenome.text := Copy(pega, 18, 2);
 valor.text := Copy(pega, 23, 2);
 try
   S.Values['processamento'] := 'normal';
   S.Values['nome'] := nome.text;
   S.Values['sobrenome'] := sobrenome.text;
   S.Values['valor'] := valor.text;

   IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
   IdHTTP1.Post('http://localhost/envia.php', S, M);
   Memo1.Lines.Add(Format('Resposta: %s', [IdHTTP1.ResponseText]));

   M.Position := 0;
   S.LoadFromStream(M);
   Memo1.Lines.AddStrings(S);
 finally
   S.Free;
   M.Free;
 end;
end;

I really need the program not to crash and that whenever the response arrives it should jump to the next line (maybe Inc (i);), I'll do this check like? in another timer?.

    
asked by anonymous 20.04.2015 / 19:09

1 answer

2

Place the TIDAntiFreeze component of the Indy palette on the form that will no longer freeze.

    
22.04.2015 / 19:58