procedure ShowMsg(sMsg:string);
begin
    ShowMessage(sMsg);
end;var  hThread:THandle;
     threadID:DWORD;
     sParam:string;     
begin
     sParam:='how are you';
     hThread:=CreateThread(nil,0,ShowMsg,@sParam,0,threadId);
end;创建线程这一行报 Not Enough Actual Parameters,请指教

解决方案 »

  1.   

    hThread:=CreateThread(nil,0,@ShowMsg,@sParam,0,threadId);
    而且在线程里不能调用ShowMessage,会造成阻塞。
      

  2.   

    来自沪上傅远山的致意([email protected]):
       Upstairs, I can't agree with you More!
      

  3.   

    谢谢SYSU,线程里面的确不宜调用SHOWMESSAGE,我只是做个测试。
      

  4.   

    但是这个sParam参数传递不到ShowMsg函数里面去,这是啥原因
      

  5.   

    sParam:string 
    改成PChar试试
      

  6.   

    下面我试了可以:
    procedure ShowMsg(sMsg:pchar); stdcall;  // 参数类型为pchar,并加上stdcall
    begin
        ShowMessage(sMsg);
    end;var  hThread:THandle;
         threadID:DWORD;
         sParam:pchar;
    begin
         sParam:='how are you';
         hThread:=CreateThread(nil,0,@ShowMsg,sParam,0,threadId);  // 注意参数
    end;