Hi!!
I have made an explorer in C++Borland Builder 6...I used components DriveComboBox,DirectoryListBox and FileListBox and i connnect them.... But when i go to other drives than 'c' with DriveComboBox that dont have anything inside(empty) it brings me an expection: "EInOutError with message I/O error 21". I used the above code to correct it and bring a message to user that the drive is empty but no luck.... If anyone have any ideas on the above code or some new please send some help......
Code:TDriveComboBox *Control = (TDriveComboBox*)Sender; AnsiString strRoot = (AnsiString)(char)Control->Drive+":\\"; DWORD dwOldErrorMode; try { dwOldErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); try { DirectoryListBox1->Drive = Control->Drive; if(!DirectoryExists(strRoot)) throw EInOutError(""); } catch(EInOutError &Error) { MessageDlg("Drive not ready!",mtError,TMsgDlgButtons()<<mbOK,0); Control->Drive = 'C'; } } __finally { SetErrorMode(dwOldErrorMode); }




Reply With Quote