就好比安装程序什么的,定点在某一界面时,程学实际正在运行,这样就会出现一个label模样的'......',并且点数不断的从1到6再从1到6,直到执行完毕,说的够清楚了吧。
我知道用线程可以实现,现在就是手头没资料,线程具体是如何实现的呢,能不能给个函数过程什么的,直接 调用就OK了?如果还不清出的就看看安装程序,或者杀毒软件什么的,都有这个功能,应该不难,可我想找一个好一点方法,就上来问问,请各位大侠出出主意。
我知道用线程可以实现,现在就是手头没资料,线程具体是如何实现的呢,能不能给个函数过程什么的,直接 调用就OK了?如果还不清出的就看看安装程序,或者杀毒软件什么的,都有这个功能,应该不难,可我想找一个好一点方法,就上来问问,请各位大侠出出主意。
解决方案 »
- 谁能告诉我 可用分 都有什么用途
- 请问用DbGrid或是从DBGrid继承写组件时,怎么才能实现同一列中对不同的行设置不同的EditMask; 为什么没有人回答呀
- ado 的多线程查询,哪位给个例子,谢了先,在线等!
- zhoutian618接分
- 我想知道联接到我电脑上的网络用户对系统做了什么操作该怎么做?如被删除文件之类的
- 关于视频卡的程序设计
- DevExpress QuantumGrid 5.0 控件不支持win2000操作系统?
- 我一直都是学CB5的,但其编译速度实在太慢,现在有意于Borland的Delphi,大家怎么看!
- 其实,Data2000并非大家说的那样啊..(恳请进来看看)
- 高手给讲讲INSTALLSHIELD。。。。。。。
- 把窗体的数据写到dbgrid的单元格
- 关于tmemorystream的合并
Classes, Windows, Activex, StdCtrls,Gauges,SysUtils,Forms,ExtCtrls;type
TTESTIMPL = class(TThread)
private
FLabel: TLabel;
FStop: PBoolean;
{ Private declarations }
procedure ShowLabel;
protected
procedure Execute; override;
public
constructor Create(vLabel: TLabel; vStop: PBoolean);
end;implementation{ Important: Methods and properties of objects in visual components can only be
used in a method called using Synchronize, for example, Synchronize(UpdateCaption); and UpdateCaption could look like, procedure TTESTIMPL.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }{ TTESTIMPL }constructor TTESTIMPL.Create(vLabel: TLabel; vStop: PBoolean);
begin
inherited create(false);
FLabel := vLabel;
FStop := vStop;
FreeOnTerminate:=true;
end;procedure TTESTIMPL.Execute;
begin
try
CoInitializeEx(nil, COINIT_APARTMENTTHREADED);
while true do
begin
if FStop^ then Break;
Synchronize(ShowLabel);
end;
CoUninitialize;
except
end;
{ Place thread code here }
end;procedure TTESTIMPL.ShowLabel;
var
i: integer;
begin
for i:=1 to 6 do
begin
FLabel.Caption := IntToStr(i);
application.ProcessMessages;
end;
end;end.unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
bStop: Boolean;
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
TESTIMPL: TTESTIMPL;
begin
bStop := false;
TESTIMPL := TTESTIMPL.Create(Label1,@bStop);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
bStop := true;
end;end.
1.用独立的ADOCONNECTION
2.在线程中执行TSQL
3.定义线程的onterminate事件,当线程结束时会自动切到主线程,去显示一些结束信息或关闭gif图片!