How to find CD loaded or not

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mvgopi76
    New Member
    • Jul 2006
    • 1

    #1

    How to find CD loaded or not

    Dear friends,

    I want to know what is the code for finding whether a cd is loaded or not in the drive ?
    will any body give me the code?
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    try out the below code segment.. it works fine me.. hope it helps you to get started with.. take care and good luck my fren.. :)

    Code:
    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 Command1_Click()
        erg& = GetVolumeInformation(Drive1.Drive, VolName$, 127&, VolNumber&, MCM&, FSF&, FSys$, 127&)
    
    
        If erg& = 0 Then
            MsgBox "There is no media In the drive"
        Else
            MsgBox "There is media In the drive"
        End If
    End Sub

    Comment

    Working...