Click to See Complete Forum and Search --> : Explorer Error


Leite33
January 31st, 2007, 11:57 PM
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......


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);
}

Krishnaa
February 1st, 2007, 12:03 AM
You mean the DriveCombo dont have other drives in the list ?

Leite33
February 1st, 2007, 02:45 AM
what you mean drivecombobox is a component where you can see the drives("c:\\,d:\\,) etc. I want some code that when i move in an empty component get a message the user("Drive not ready");

eero_p
February 1st, 2007, 02:49 AM
What is contents of 'DirectoryExists' ?

What control calls the method you listed? Is it used for callback of several controls since the first line (which seems quite useless to me otherwise)? (TDriveComboBox *Control = (TDriveComboBox*)Sender; )

Leite33
February 1st, 2007, 05:35 AM
My code is OnDriveComboBoxChange event the DirectoryListBox contains folders, the FileListBox contains files and the DriveComboBox contains the drives ofcourse!!!! I cant be more specifiec!!!!!!Sorry