(Gast)
n/a Beiträge
|
AW: Try Finally End verlassen bzw. abbrechen
31. Mai 2014, 09:27
Ich würde das so lösen:
Delphi-Quellcode:
Procedure TForm1.BtnStartClick(Sender: TObject);
Const
DummySpace ='C:\$space';
Procedure _DemandDirectoryCreated(string aDirectory);
Begin
CreateDir(aDirectory);
if Not DirectoryExists(aDirectory) Then
Abort;
end;
Begin
BtnStart.Enabled:=False;
MELog.Lines.Clear;
Try
MELog.Lines.Append('Step 1: Allocating Memory');
MELog.Lines.Append('- creating directory "' + DummySpace + '"');
_DemandDirectoryCreated(DummySpace);
MELog.Lines.Append(' success...');
// Hier nur weiter, wenn Verzeichnis angelegt wurde/existiert
Except
MELog.Lines.Append(' Could not create "' + DummySpace + '".');
MELog.Lines.Append(' Error was: "' + SysErrorMessage(GetLastError) + '"');
MELog.Lines.Append(' Opreation aborted.');
End;
BtnStart.Enabled:=True;
End;
|
|
Zitat
|