VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Check whether cd drive is exist or not and run a particular application.txt exist in the cd.

by Chandresh Kumar (1 Submission)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 1st September 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Check whether cd drive is exist or not and run a particular application.txt exist in the cd.

API Declarations



Public Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long


Rate Check whether cd drive is exist or not and run a particular application.txt exist in the cd.



Public Sub GetCDDrive()
    On Error GoTo ErrC
    Dim DriveNumber As Integer
    Dim GotCDDrive As Boolean
    Dim runApplication
    
    GotCDDrive = False
    
    For DriveNumber = 68 To 79
        If GetDriveType(Chr(DriveNumber) & ":\") = 5 Then
            runApplication = Shell(Chr(DriveNumber) & ":\myApplicationFiles\RunThisApplication.exe", vbMaximizedFocus)
            GotCDDrive = True
            Exit Sub
        End If
    Next DriveNumber
    
    If Not GotCDDrive Then
        MsgBox "No CD Drive detected in your system"
    End If
    
    Exit Sub

ErrC:
    If Err.Number <> 53 Then        'If proper CD is not inserted in the Drive and Drive is detected
        MsgBox "Error Occured" & vbCr & Err.Description, vbInformation
    Else
        MsgBox "Please Insert My CD version 1.3 !!!", vbInformation
    End If
    Exit Sub
End Sub


Download this snippet    Add to My Saved Code

Check whether cd drive is exist or not and run a particular application.txt exist in the cd. Comments

No comments have been posted about Check whether cd drive is exist or not and run a particular application.txt exist in the cd.. Why not be the first to post a comment about Check whether cd drive is exist or not and run a particular application.txt exist in the cd..

Post your comment

Subject:
Message:
0/1000 characters