dpr文件begin
CreateThread(nil, 0, @aa, nil, 0, bb);
其它代码
其它代码
其它代码
end.执行完 '其它代码'后 aa这个线程也会终止 为了让aa不停止 我在end.前加了个 while true do sleep(9999);这样就可以了 可总觉得这样不太好又听说用FreeOnTerminate Terminated WaitFor之类的东西可以办到 试了半天不会玩 这个dpr文件中的begin...end.间的东西也算个线程吧 怎么让它不terminate 怎么让它waitfor呢
CreateThread(nil, 0, @aa, nil, 0, bb);
其它代码
其它代码
其它代码
end.执行完 '其它代码'后 aa这个线程也会终止 为了让aa不停止 我在end.前加了个 while true do sleep(9999);这样就可以了 可总觉得这样不太好又听说用FreeOnTerminate Terminated WaitFor之类的东西可以办到 试了半天不会玩 这个dpr文件中的begin...end.间的东西也算个线程吧 怎么让它不terminate 怎么让它waitfor呢
解决方案 »
- 将参数改为数组
- 使用mydac组件时问题,自带的dll封装MyConnection1的,MyTable1只能保存一次,保存第二次就出现FUpdateQuery is TCustomMyDataSet错误
- CSDN的专家分、可用分、参与分是什么关系啊,都有什么用呢?
- HELP!!!!!!!!!
- 如何对enable属性为false的memo控件中显示的内容进行复制,拷贝?
- 请介绍一下delphi自带的工具程序(如brcc32、tdump等)
- 怎样从刷卡器上读取磁卡中得信息?
- Access加上密码后,为何ADO不能联接?
- 怎么样 才能把一个数组转化为一个字符串啊
- Delphi和那种数据关联最密切?
- [分享]FastReport4.8給Memo變量賦值
- [请教]delphi屏幕截图问题
CreateThread(nil, 0, @aa, nil, 0, bb);
其它代码
其它代码
其它代码
end. 执行完这些东西后 aa这个线程不就停止了吗 不能让它停dpr文件 begin
CreateThread(nil, 0, @aa, nil, 0, bb);
其它代码
其它代码
其它代码
while true do sleep(999999);
end.
我改成这样就能达到目的了,但不想用这样的
unit Unit1;interfaceuses
Classes,SyncObjs;type
TMyThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
public
constructor Create(CreateSuspended: Boolean);
destructor Destroy; override;
end;implementation
constructor TMyThread.Create(CreateSuspended: Boolean);
begin
FreeOnTerminate:=False;
end;destructor TMyThread.Destroy;
begin inherited;
end;procedure TMyThread.Execute;
begin
While not Terminate do
begin
case QuitEvent.WaitFor(1000) of // until SetEvent set the event to signaled
wrSignaled, wrAbandoned: Terminate;
end;
end;initialization
QuitEvent := TEvent.Create(nil,true,false,'QuitEvent');finalization
QuitEvent.Free;end.
var
h: THANDLE;
begin
h := CreateThread(nil, 0, @aa, nil, 0, bb);
其它代码
其它代码
其它代码 WaitForSingleObject(h, INFINITE);
end.