怎样用delphi实现多线程操作
解决方案 »
- 怎样把Delphi7的帮助文档关联到Delphi2007,我下载的2007精简版没有安装帮助,多谢!
- 做一个类似qq的聊天程序,大家给点思路;
- 我的网站 www.31qq.com 请大家看看去 顶者有分!!!!!!!!
- fastreport报表如何导出word文件?
- 怎樣設置ADOQUERY數據集是可讀和可寫
- 如何得知chart的原点在form上的坐标值(或知道left值),以及X轴的长度
- Delphi中10的n次幂的函数是什么?
- 求救:用DELPHI6做WEB SERVICES,总是出现“name not unique in context”
- HS开头的是什么控件呀
- delphi自己写的功能怎么做成插件加到IDE里
- 多线成
- 这样为什么会出错?
就那样实现呀?你说的是什么意思?
给你个例子:
type Tplay=class(tthread)
private
sBar:tstatusBar;
procedure play;
protected
procedure execute;override;
public
constructor create(statusbar:tstatusbar);
end;{ Tplay }constructor Tplay.create(statusbar:tstatusbar);
begin
sbar:=statusbar;
FreeOnTerminate:=true;
inherited create(false);
end;procedure Tplay.execute;
begin
inherited;
synchronize(play);
end;procedure Tplay.play;
var
len,loc,dir:integer;
begin
len:=50;
loc:=5;
dir:=0;
while comOPEND do
begin
application.ProcessMessages;
sbar.Panels.Items[1].Text:=stringofchar(' ',loc)+'||||||||||'+stringofchar(' ',len-loc-10);
sleep(50);
if dir=0 then
if loc<40 then
inc(loc)
else
dir:=1
else if loc>5 then
dec(loc)
else
dir:=0;
end;
sbar.Panels.Items[1].Text:='';
end;