方法为
线程类:
//unit2.pas
type
ss = class(TThread)
private
procedure mm;
{ Private declarations }
protected
procedure Execute; override; end;implementation{ Important: Methods and properties of objects in VCL or CLX can only be used
in a method called using Synchronize, for example, Synchronize(UpdateCaption); and UpdateCaption could look like, procedure ss.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }{ ss }procedure ss.Execute;
begin
Synchronize(mm); { Place thread code here }
end;
procedure ss.mm;
var mm:TForm;
begin
mm:=tform.Create(nil);
mm.ShowModal;
end;
//unit1.pas
var mm:ss;
begin
mm:=ss.Create(true);
mm.Resume;
end;
线程类:
//unit2.pas
type
ss = class(TThread)
private
procedure mm;
{ Private declarations }
protected
procedure Execute; override; end;implementation{ Important: Methods and properties of objects in VCL or CLX can only be used
in a method called using Synchronize, for example, Synchronize(UpdateCaption); and UpdateCaption could look like, procedure ss.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }{ ss }procedure ss.Execute;
begin
Synchronize(mm); { Place thread code here }
end;
procedure ss.mm;
var mm:TForm;
begin
mm:=tform.Create(nil);
mm.ShowModal;
end;
//unit1.pas
var mm:ss;
begin
mm:=ss.Create(true);
mm.Resume;
end;
解决方案 »
- 求刷卡机编程解决方案
- [新手求助]日期数据录入数据库的问题!
- ■■■如可实现在 ComboBox 文本框中录入信息,能自动模糊检索出items条目中功能■■■
- 求助:如何利用sleep()
- 去掉数字中的逗号分隔符。急等
- 有关ClientDataSet的CommandText问题?
- UDP包过大,如何解决多次发送,接收问题?
- 关于多个txt文件查询问题
- 谁能告诉我BoundsChecker(Delphi Edition)最新版的下载地址和注册码,下载成功后送50分!
- 我和一个朋友开发的一个软件,20000RMB,东西都是我做的,给我2000RMB,他跑业务,大家给说说看.
- 请教,我用WISE 9 打抱是一切正常,但生成的安装程序,我安装后在程序里找不到,怎么回事呀?是
- 请问在delhpi中,在做sql插入时,这个错误是怎么回事,谢先!
同意不要在线程中创建窗体。