if (MyThread1 <> nil) and (not MyThread1.Terminated) then
   begin
     MyThread1.Terminate;
     MyThread1.WaitFor; 
   end;

解决方案 »

  1.   

    用函数exitthread
    查查delphi的帮助,有关于这个函数的介绍。或者直接用API函数就可以了。
      

  2.   

    呵呵,此方法太过狠毒,老兄还是少用为妙!!if GetExitCodeThread(aThread.Handle) = STILL_ACTIVE then  //如果还在运行,
       TerminateThread(aThread.Handle, 0);  //结束线程
      

  3.   

    呵呵,错了,应是这种形式!var
      ExitCode : DWORD;
    begin
      if GetExitCodeThread(aThread.Handle, ExitCode)  then
        if  ExitCode = STILL_ACTIVE then  //如果还在运行,
           TerminateThread(aThread.Handle, 0);  //结束线程
      

  4.   

    to:up
    GetExitCodeThread怎么用啊,我用不懂。
    上面的例子运行不了。有没有具体的?
      

  5.   

    呵呵,是不是用错了变量名,刚才没注意,ExitCode好像是System单元中的一个全局变量,w你将ExitCode改个名字吧!