PDA

Click to See Complete Forum and Search --> : CD drive


nevyn
Jul 27th, 2000, 03:37 AM
I'm writing an access application that prompts the user to insert a CD in the drive, afterwards when I try to access the drive I get errors like 'device not ready' ...
Is there a way to determine if the drive is ready?

thanks

rino_2
Jul 30th, 2000, 10:02 AM
Hi nevyn,

This is just a suggestion and I haven’t tried it myself but it may be worth a go. Try using the GetVolumeInformation API and if there is no Volume label then the drive isn’t ready. Let me know if it works. Good Luck!

Jul 30th, 2000, 01:53 PM
This was a good example from Mark Sreeves.

Function DiskInDrive() As Boolean
On Error GoTo ErrHan
Dir "D:\", vbDirectory

DiskInDrive = True
Exit Function

ErrHan:
DiskInDrive = False

End Function

If DiskInDrive() Then
MsgBox "There is a CD in D drive."
Else
MsgBox "No CD detected in D drive."
End If

nevyn
Jul 31st, 2000, 02:10 AM
Thanks for the information, I will certainly try the suggestions and I will let you know the results

rino_2
Jul 31st, 2000, 02:28 PM
Hi nevyn,

The way that I suggested with the GetVolumeInformation API does work, I tested it myself. Although I think you would be better off using Matthew Gates's way because its much easier! :)