Detectar CD con VB
Agradeceria cualquier codigo que permita detectar que hay un CD en la unidad, poniendo un 1 en un campo si hay CD, o un 0 si no lo hay.
Esto es lo que encontre en un libro, espero te sea util:
Public Function TestForDataCD(TestFile As String) As String
Dim nDrive as String
Dim i as integer
Dim nTest as String
on error Resume Next
For i=67 to 90
ndrive=chr$(i) & ":"
if GetDriveType(nDrive)=Drive_CDROM then
ntest=dir(ndrive & testFile)
if len(ntst) then
testfordatacd=ndrive
exit function
endif
endif
next ´i
end function
Public Function TestForDataCD(TestFile As String) As String
Dim nDrive as String
Dim i as integer
Dim nTest as String
on error Resume Next
For i=67 to 90
ndrive=chr$(i) & ":"
if GetDriveType(nDrive)=Drive_CDROM then
ntest=dir(ndrive & testFile)
if len(ntst) then
testfordatacd=ndrive
exit function
endif
endif
next ´i
end function
