هل من طريقة لتحديد رمز ال CD-Drive و اذا كان يوجد على الجهاز اكثر من CD-drive باستخدام ال VBA
معرفة CD-Driveفي الVBA
مغلق
باستخدام دوال ال api
و طبعا مع استبدال حدث Form_Load() بالحدث المناسب لديك
Task: Get Drive Type using GetDriveType API
Private Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Const DRIVE_UNKNOWN = 0
Private Const DRIVE_DOES_NOT_EXIST = 1
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()
Select Case GetDriveType("C:")
Case DRIVE_UNKNOWN
MsgBox "Unknown drive type", vbExclamation
Case DRIVE_DOES_NOT_EXIST
MsgBox "Drive doesn't exist", vbCritical
Case DRIVE_REMOVABLE
MsgBox "The disk can be removed from the drive", vbInformation
Case DRIVE_FIXED
MsgBox "The disk cannot be removed from the drive", vbInformation
Case DRIVE_REMOTE
MsgBox "The drive is a remote (network) drive", vbInformation
Case DRIVE_CDROM
MsgBox "The drive is a CD-ROM drive", vbInformation
Case DRIVE_RAMDISK
MsgBox "The drive is a RAM disk", vbInformation
End Select
End
End Sub
'Visit my Homepage at
'http://www.geocities.com/marskarthik
'http://marskarthik.virtualave.net
'Email: marskarthik@angelfire.comهذا الموضوع مغلق.
