¡Tengo otra pregunta! Por favor mira este ejemplo:Cómo pasar la excepción de un hilo a otro (el que llama) el hilo en Delphi?
// There is a class with some method:
type
TMyClass = class
public
procedure Proc1;
end;
// There is a some thread class:
TMyThread = class(TThread)
protected
procedure Execute; override;
end;
procedure TMyClass.Proc1;
begin
// this method is just calling another thread:
with TMyThread.Create(True) do
begin
FreeOnTerminate := True;
Resume;
end;
// + there are some more actions
end;
procedure TMyThread.Execute;
begin
// in this example this thread just throws exception:
raise Exception.Create('Some exception');
end;
Todo lo que quiero - es conseguir excepción planteada en la TMyClass.Proc1 y tirarlo así:
var
myObject: TMyClass;
begin
myObject := TMyClass.Create;
try
myObject.Proc1; // launch and watch what happenings
except
on E: Exception do
WriteErrorLog(E.Message);
end;
FreeAndNil(myObject);
end;
Por favor, dígame cómo puedo hacer algo ¿Me gusta esto? Muchas gracias!
oh! una cosa más: estoy codificando en Delphi 5 así que no tengo la propiedad "FatalException" de TThread o algo así ...
Necesita aceptar una respuesta o si no hay respuesta es suficiente para indicar que, por ejemplo, mediante el comentario – Remko