他又不是一直都返回这样的错误,有时候有,有什候又没有。我查了一下,1444是指错误的线程ID,但我再检查线程ID号是正常的啊,郁闷!
另外,在Form的Create中创建线程关Resume后,马上向该线程发送消息,一定会返回这个错误,有人知道原因吗?

解决方案 »

  1.   

    线程里面需要建立消息循环,不知道你建了没有,
    var
      m_TMsg:TMsg;            //消息句柄
    begin
      PeekMessage(m_TMsg,0,WM_USER,WM_USER,PM_NOREMOVE);
      //类似这样的MsgWaitForMultipleObjects等待函数
      while PeekMessage(m_TMsg,0,0,0,PM_REMOVE) do
      begin
        if m_TMsg.hwnd = 0 then
        begin
          case m_TMsg.message of
            ....
          end;
        end else
        begin
          DispatchMessage(m_TMsg);
        end;
      end;
    end;
    类似这样的
      

  2.   

    有啊,我的消息循环代码是这样:
       PeekMessage(Msg, 0, WM_USER, WM_USER, PM_NOREMOVE);
       while not Terminated do begin
       if PeekMessage(Msg,0,0,0,PM_REMOVE)then
         case Msg.Message of
           .....
         end;
       end;