W wlong01 Unregistered / Unconfirmed GUEST, unregistred user! 2003-12-30 #1 动态生成线程时,,如果中断线程,会出玩非法句柄错误?
Q qince Unregistered / Unconfirmed GUEST, unregistred user! 2003-12-30 #2 如果在写Execute时判断了Terminted,那么最后只用将Termained := True, 而且最好在创建的时候写上FreeOnTerminted := True; 就不会出现非法局柄了。
W wlong01 Unregistered / Unconfirmed GUEST, unregistred user! 2003-12-30 #3 MyThread1.Terminate; //中止线程,释放内存 MyThread1.WaitFor; //等中止(我将这一条删了,就不会出现 非法句柄 错误了)
Q qince Unregistered / Unconfirmed GUEST, unregistred user! 2003-12-30 #4 你改成这样试试: if Assigned(MyThread1) then MyThread1.Terminate; if Assigned(MyThread1) then MyThread1.WaitFor;
你改成这样试试: if Assigned(MyThread1) then MyThread1.Terminate; if Assigned(MyThread1) then MyThread1.WaitFor;
J jzpcom Unregistered / Unconfirmed GUEST, unregistred user! 2003-12-31 #5 在你创建线程的时候写上FreeOnTerminted := True;应该不会有问题