شناسایی CD ROM در سیستم :
دو تا لیبل بزارید توی فرمتون به نام های Lable1 و l1
این کدها رو به فرمتون اضافه کنین :
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function GetLogicalDriveStrings Lib "kernel32" Alias "GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Const Drive_Removable = 2
Private Const Drive_Fixed = 3
Private Const Drive_Remote = 4
Private Const Drive_CDRom = 5
Private Const Drive_RamDisk = 6
Private Sub Form_Load()
Dim R As Long
Dim AllDrives As String
Dim JustOneDrive As String
Dim Pos As Integer
Dim DriveType As Long
Dim CDFound As Boolean
AllDrives = Space$(64)
R = GetLogicalDriveStrings(Len(AllDrives), AllDrives)
AllDrives = Left$(AllDrives, R)
Do
Pos = InStr(AllDrives, Chr$(0))
If Pos Then
JustOneDrive = Left$(AllDrives, Pos)
AllDrives = Mid$(AllDrives, Pos + 1, Len(AllDrives))
DriveType = GetDriveType(JustOneDrive)
If DriveType = 5 Then
CDFound = True
Exit Do
End If
End If
Loop Until AllDrives = "" Or DriveType = Drive_CDRom
If CDFound Then
L1 = UCase(JustOneDrive)
Else
L1 = "No CDRom"
End If
End Sub





پاسخ با نقل قول
