Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
Delphi 10.2 Tokyo Professional
|
Re: Sinnvoller Einsatz von goto
20. Mär 2010, 01:37
Nunja ein try-finally wäre wohl die richtige Wahl in dieser Situation
Delphi-Quellcode:
function DemoThread(p: Pointer): Integer;
var
i: Integer;
ParentHandle: THandle;
begin
try
ParentHandle := PThreadParams(p)^.ParentHandle;
for i := 0 to 9 do
begin
if Abort then
begin
SendMessage(ParentHandle, CM_ABORT, 0 , 0);
exit;
end;
SendMessage(ParentHandle, CM_STATUS, Integer(PChar('Durchlauf:')), i);
Sleep(500);
end;
SendMessage(ParentHandle, CM_FINISHED, 0, 0);
finally
Dispose(p);
Result := 0;
end;
end;
Michael "Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
|
|
Zitat
|