【发布时间】:2014-12-14 20:58:22
【问题描述】:
这段代码如何使用线程,这段代码让程序采取快速锁定线程会更好?
如何重复线程直到 i = ListBox1.Items.Count -1
var
lURL : String;
lResponse : TStringStream;
begin
lResponse := TStringStream.Create('');
TestText := Form1.ListBox1.Items[i];
I := i +1;
Test1 := Copy(TestText, 0, 16);
Test2 := Copy(TestText, 18, 3);
Test3 := Copy(TestText, 22, 2);
Test4 := Copy(TestText, 27, 2);
try
lURL := 'http://www.test.net/test/test.php' +
'?n=' + Test1 +
'&m=' + Test2 +
'&a=' + Test3 +
'&cv=' + Test4;
idHttp1.Get(lURL, lResponse);
lResponse.Position := 0;
RichEdit1.Lines.LoadFromStream(lResponse);
finally
IdHTTP1.Free;
lResponse.Free();
if Pos('Bazinga',RichEdit1.Text)> 0 then
label1.Caption := 'True';
end;
end;
【问题讨论】:
-
这是一个很好的例子:Working with Indy HTTP。该代码适用于 Dephi7 - 您的里程可能会因您的版本而异。
-
你用的是哪个Delphi版本?
-
我现在用的是Delphi XE6,也想知道线程一结束怎么重复。
标签: multithreading delphi idhttp