01-13-2012، 11:55 AM
(01-13-2012، 11:44 AM)Secret نوشته: سلام
اینم کدی که خواستید :
کد:Private Declare Function GetDriveType Lib "kernel32.dll" Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long ' tavasot in api mitonim vaziat driveha ro be dast biarim
Const DRIVE_CDROM = 5 ' inja tarif mikonim mesalan agar drive h az noa cd rom bod addad 5 ro khoroji bede
Const DRIVE_FIXED = 3
Const DRIVE_RAMDISK = 6
Const DRIVE_REMOTE = 4
Const DRIVE_REMOVABLE = 2 ' FLASH DISK
Private Sub Form_Load()
If GetDriveType("h:") = 2 Then 'agar DRIVE AZ noa usb bod dastor zIR EJRA BESHE
MsgBox "detect usb"
Else ' ELSE: AGAR DRIVE H AZ NOA USB NABOD DASTOR ZIR EJRA NASHE
MsgBox ("DRIVE AZ NOA USB NIST")
End If
If GetDriveType("i:") = 2 Then 'agar DRIVE i aZ noa usb bod dastor zIR EJRA BESHE
MsgBox "detect usb"
Else ' ELSE: AGAR DRIVE H AZ NOA USB NABOD DASTOR ZIR EJRA NASHE
MsgBox ("DRIVE AZ NOA USB NIST")
End Sub
خیلی لطف کردی ،دستت درد نکنه امتحان می کنم.
بازم ازتون ممنونم.