怎样用delphi实现多线程操作

解决方案 »

  1.   

    ???
    就那样实现呀?你说的是什么意思?
    给你个例子:
    type Tplay=class(tthread)
        private
        sBar:tstatusBar;
        procedure play;
        protected
        procedure execute;override;
        public
        constructor create(statusbar:tstatusbar);
    end;{ Tplay }constructor Tplay.create(statusbar:tstatusbar);
    begin
      sbar:=statusbar;
      FreeOnTerminate:=true;
      inherited create(false);
    end;procedure Tplay.execute;
    begin
      inherited;
      synchronize(play);  
    end;procedure Tplay.play;
    var
    len,loc,dir:integer;
    begin
    len:=50;
    loc:=5;
    dir:=0;
    while comOPEND do
    begin
    application.ProcessMessages;
    sbar.Panels.Items[1].Text:=stringofchar(' ',loc)+'||||||||||'+stringofchar(' ',len-loc-10);
    sleep(50);
    if dir=0 then
    if loc<40 then
      inc(loc)
    else
      dir:=1
    else if loc>5 then
      dec(loc)
    else
      dir:=0;
    end;
    sbar.Panels.Items[1].Text:='';
    end;
      

  2.   

    请问多线程单元没有窗体怎么学代码且'comOPEND'没有定义