Originally, you indicated that you wanted to TRAP the dialog from popping up... Try this:
UINT prevErrorMode;
// save off the current error mode
prevErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
// access the media... or not, but the error will come
// in the form of a return code, and...