CodeItBetter Programming Another VB Programming Blog

How to check whether CD/Floppy Disk is in the Drive

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'File/Folder Handling - How to check whether CD/Floppy Disk is in the Drive

Option Explicit
 
Declare Function GetVolumeInformation Lib "kernel32" Alias "GetVolumeInformationA" _
    (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, _
    lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, _
    ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
 
Private Sub Main()
    Dim VolName$, VolNumber&, MCM&, FSF&, FSys$
    If GetVolumeInformation("A:\", VolName$, 127&, VolNumber&, MCM&, FSF&, FSys$, 127&) = 0 Then
        MsgBox "There is no media in the drive"
    Else
        MsgBox "There is a media in the drive"
    End If
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.