Check whether cd drive is exist or not and run a particular application.txt exist in the cd.
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.
(2(2 Vote))
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
Check whether cd drive is exist or not and run a particular application.txt exist in the cd. Comments
No comments yet — be the first to post one!
Post a Comment