I want to be able to catch the exception thrown when trying to write to a
"locked" Usb drive.
For instance:
private void WriteToUsbDrive (string filePath, byte[] theBytes)
{
...
try
{
File.WriteAllBytes (filePath, theBytes);
}
catch (Exception ex) // Just for the example, assume only IO errors
occurred because the key is locked
{
MessageBox.Show ("Unlock the key!!!");
}
}
Testing on Vista, the system dialog will popup first telling the user that
the drive is locked, after clicking away that dialog, my dialog will then
appear - how can I prevent the OS system's dialog from appearing?
TIA