Ver Mensaje Individual
  #1  
Antiguo 31-01-2016
Ramsay Ramsay is offline
Miembro
NULL
 
Registrado: ene 2016
Posts: 104
Reputación: 9
Ramsay Va por buen camino
Error con multihilos

Hola , tengo un problema haciendo multireading , estoy tratando de crear cinco que muestren simplemente un mensaje , el problema es que siempre muestra el error "Exception class EAccessViolation with message 'Access violation at address" al usarlo

Código Delphi [-]
type
  TMyThread = class(TThread)
  protected
    procedure Execute; override;
  public
    text: string;
    property ReturnValue;
  end;

procedure TMyThread.Execute;
begin
  if Terminated then
    Exit;
  MessageDlgPos(text, mtInformation, [mbOk], 0, 100, 200);
end;

procedure TForm1.btnTestClick(Sender: TObject);
var
  LThread: TMyThread;
  i: Integer;
begin

  For i := 1 to 5 do
  begin
    LThread := TMyThread(Sender);
    try
      LThread.text := 'hi';
      LThread.FreeOnTerminate := True;
    except
      LThread.Free;
      raise;
    end;
    LThread.Resume;
  end;
end;

¿ Cual es el problema ?
Responder Con Cita