//我的线程函数如下:
procedure TCopyThread.Execute;begin Messagebox('OK', '提示', MB_OK + MB_ICONWARNING)end;然后在主窗口中的一个Button函数中:
thread := TCopyThread.Create(false);为什么不能出现对话框呢?
procedure TCopyThread.Execute;begin Messagebox('OK', '提示', MB_OK + MB_ICONWARNING)end;然后在主窗口中的一个Button函数中:
thread := TCopyThread.Create(false);为什么不能出现对话框呢?
//其他情况要考虑线程同步的问题
type
TCopyThread = class(TThread)
private
procedure Method;
protected
procedure Execute; override;
end;procedure TCopyThread.Execute;
begin
Synchronize(Method);
end;procedure TCopyThread.Method;
begin
Messagebox(0, 'OK', '提示', MB_OK + MB_ICONWARNING)
end;