Error c0000013
means that there is no (readable) media the in location that you're accessing.
See: http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382%28v=vs.85%29.aspx
As such it is perfectly ok to check for the error and move on if there's no media.
You can get a list of all USB devices like so (see: Delphi - How to get list of USB removable hard drives and memory sticks?)
procedure GetUsbDrives(List: TStrings);
var
DriveBits: set of 0..25;
I: Integer;
Drive: AnsiChar;
begin
List.BeginUpdate;
try
Cardinal(DriveBits) := GetLogicalDrives;
for I := 0 to 25 do
if I in DriveBits then
begin
Drive := Chr(Ord('a') + I);
if GetBusType(Drive) = BusTypeUsb then
List.Add(Drive);
end;
finally
List.EndUpdate;
end;
end;
If you then access the drive and get the error, simply use a try-except to dectect if any problems occur, see: Delphi - how to get a list of all files of directory
function IsDevicePresent(DriveLetterOrPath: string): boolean;
const
success = 0;
Win_DeviceIsPresent = true;
Fail_DeviceNotPresent = false;
var
SearchRec: TSearchRec;
Drive: string;
begin
Drive:= ExtractFileDrive(DriveLetterOrPath);
try
Result:= (FindFirst(Drive, faAnyFile, SearchRec) = success);
except
Result:= Fail_DeviceNotPresent;
end; {try}
end;