2
 Private Declare Function GetDriveType Lib "kernel32" Alias _ "GetDriveTypeA" (ByVal nDrive As String) As Long Private Sub Form_Load() Dim intLoopCounter As Integer Dim strCDDrives As String For intLoopCounter = 65 To 90 If (GetDriveType(Chr(intLoopCounte r) & ":") = 5) Then strCDDrives = strCDDrives & Chr(intLoopCounter) & vbCrLf End If Next intLoopCounter MsgBox "CD Rom Drives On this PC are : " & _ vbCrLf & vbCrLf & strCDDrives End Sub Now I need to loop through all the CD-ROM drives and see if MyApp.exe is in the root. If it is in the root then, Form2.Show If it's not in the root then: Msgbox "Please insert the MyApp CD-ROM"

Source Code Detect Drive CDROM

Embed Size (px)

Citation preview

Page 1: Source Code Detect Drive CDROM

7/21/2019 Source Code Detect Drive CDROM

http://slidepdf.com/reader/full/source-code-detect-drive-cdrom 1/1

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

Private Sub Form_Load()Dim intLoopCounter As IntegerDim strCDDrives As String

For intLoopCounter = 65 To 90If (GetDriveType(Chr(intLoopCounter) & ":") = 5) ThenstrCDDrives = strCDDrives & Chr(intLoopCounter) & vbCrLfEnd IfNext intLoopCounter

MsgBox "CD Rom Drives On this PC are : " & _ vbCrLf & vbCrLf & strCDDrivesEnd Sub

Now I need to loop through all the CD-ROM drives and see if MyApp.exe is in theroot. If it is in the root then,Form2.ShowIf it's not in the root then:Msgbox "Please insert the MyApp CD-ROM"