R
rickyjia
Unregistered / Unconfirmed
GUEST, unregistred user!
如下代码:
procedure TFilesUpload.btnCancelClick(Sender: TObject);
begin
bThreadFlag := False;
SetEvent(hEvent);
end;
procedure TFilesUpload.OnSendFile;
begin
hEvent := Windows.CreateEvent(nil, False, False, nil);
hThread := CreateThread(nil, 0, @SendFileByDataSteam,@ThreadParam,0,ThreadID);
repeat
begin
ret := MsgWaitForMultipleObjects(1, hEvent, False, INFINITE, QS_ALLINPUT);
Application.ProcessMessages;
if not bThreadFlag then
break;
end;
until(ret = WAIT_OBJECT_0);
CloseHandle(hEvent);
end;
点击取消按钮,发送一个消息给进程,想取消它,但是执行后报错,请问问题出现在哪里?
procedure TFilesUpload.btnCancelClick(Sender: TObject);
begin
bThreadFlag := False;
SetEvent(hEvent);
end;
procedure TFilesUpload.OnSendFile;
begin
hEvent := Windows.CreateEvent(nil, False, False, nil);
hThread := CreateThread(nil, 0, @SendFileByDataSteam,@ThreadParam,0,ThreadID);
repeat
begin
ret := MsgWaitForMultipleObjects(1, hEvent, False, INFINITE, QS_ALLINPUT);
Application.ProcessMessages;
if not bThreadFlag then
break;
end;
until(ret = WAIT_OBJECT_0);
CloseHandle(hEvent);
end;
点击取消按钮,发送一个消息给进程,想取消它,但是执行后报错,请问问题出现在哪里?