贴上你的源码吧,@geturl是你写的一个过程吧?
如果不想贴,给你个例子吧
var
Form1: TForm1;
ThreadHandle: THandle; // holds the handles the threads
ThreadHandle2: THandle;
CriticalSection: TRTLCriticalSection; // holds the critical section info
implementation
{$R *.DFM}
function ThreadFunc(Info: Pointer): Integer; stdcall;
var
Count : Integer; // general loop control variable
begin
{performing the EnterCriticalSection function prevents the second thread
from executing until this thread leaves the critical section}
EnterCriticalSection(CriticalSection);
{show a visual display}
for Count := 0 to 100 do
begin
Form1.Edit1.Text := IntToStr(Count);
end;
{display a message}
Form1.Edit1.Text := 'Hello from the thread!';
{pause for a second}
Sleep(1000);
{leave the critical section and exit the thread}
LeaveCriticalSection(CriticalSection);
ExitThread(4);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ThreadId1, ThreadId2: DWORD; // holds the created thread identifiers
begin
{initialize the critical section information}
InitializeCriticalSection(CriticalSection);
{create and execute the first thread}
ThreadHandle := CreateThread(nil, 0, @ThreadFunc, nil, 0, ThreadId1);
{create and execute the second thread}
ThreadHandle2 := CreateThread(nil, 0, @ThreadFunc, nil, 0, ThreadId1);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
{we are done, so destroy the critical section information}
DeleteCriticalSection(CriticalSection);
end;
标签:delphi,CreateThread,Unit1