I have written a code in C++ builder in which I use header FileCtrl.hpp and I call SelectDirectory procedure so that the user can choose the a directory. When I change the drive to empty floppy disk or DVD drives, I get Exception EInOutError. I used try catch, bu it didn't work.
try{
SelectDirectory(path, TSelectDirOpts(), 0);
}catch (EInOutError &exception)
{
Application->ShowException(&exception);
}
Then I looked at the procedure in FileCtrl.pas responsible for drive change and I modified it but again nothing changed, I still get the exception.What Should I do?
procedure TDirectoryListBox.DriveChange(NewDrive: Char);
begin
if (UpCase(NewDrive) <> UpCase(Drive)) then
begin
if NewDrive <> #0 then
begin
ChDir(NewDrive + ':');
if IOResult<>0 then
begin
MessageDlg('Warning', mtWarning, [mbOk], 0);
Exit;
end;
GetDir(0, FDirectory);
end;
if not FInSetDir then
begin
BuildList;
Change;
end;
end;
end;