try{ SelectDirectory(path, TSelectDirOpts(), 0); }catch (EInOutError &exception) { Application->ShowException(&exception); }
procedure TDirectoryListBox.DriveChange(NewDrive: Char); begin if (UpCase(NewDrive) <> UpCase(Drive)) then begin if NewDrive <> #0 then begin {$I-} ChDir(NewDrive + ':'); if IOResult<>0 then begin {$I+} MessageDlg('Warning', mtWarning, [mbOk], 0); Exit; end; {$I+} GetDir(0, FDirectory); end; if not FInSetDir then begin BuildList; Change; end; end; end;
To trap EInOutError enable "I/O checking" in the Pascal tab of the project options in order for EInOutError exceptions to be trapped. It seems EInOutError is a delphi class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)