التنبيهات التالية ظهرت :
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 864 - File: showthread.php PHP 7.4.33 (Linux)
File Line Function
/showthread.php 864 errorHandler->error



تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
كود لمعرفة جميع ال Drivers الموجودة في جهاز الكومبيوتر
#1
كاتب الموضوع : AhmedEssawy

يختص هذا الأمر بالعودة بجميع (السواقات ) Drivers الموجودة في جهازك ، وبدلالة أرقام معينة سيتم توضيحها بعد ضمن الكود باستخدام جملة Select Case .

في الجينرال :


كود :
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" _
(ByVal nDrive As String) As Long
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" _
(ByVal lpRootPathName As String, lpSectorsPerCluster As Long, _
lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, _
lpTtoalNumberOfClusters As Long) As Long

Private Declare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectoryA" _
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Const DRIVE_CDROM = 5
Const DRIVE_FIXED = 3
Const DRIVE_RAMDISK = 6
Const DRIVE_REMOTE = 4
Const DRIVE_REMOVABLE = 2
والأمر :


كود :
Dim driveType As Long
Dim freeSpace As Long
Dim Sectors As Long
Dim Bytes As Long
Dim freeClusters As Long
Dim totalClusters As Long
Dim retValue As Long
Dim buffer As String * 255
driveType = GetDriveType(Drive1.Drive & "\")
Select Case driveType
Case 0
Label5.Caption = "UNDETERMINED"
Case 1
Label5.Caption = "NO ROOT"
Case DRIVE_REMOVABLE
Label5.Caption = "REMOVABLE"
Case DRIVE_FIXED
Label5.Caption = "FIXED"
Case DRIVE_REMOTE
Label5.Caption = "REMOTE"
Case DRIVE_CDROM
Label5.Caption = "CDROM"
Case DRIVE_RAMDISK
Label5.Caption = "RAMDISK"
End Select
retValue = GetDiskFreeSpace(Left(Drive1.Drive, 2) & "\", Sectors, Bytes, freeClusters, totalClusters)
If retValue > 0 Then
Label6.Caption = Sectors * Bytes * freeClusters
Label12.Caption = Sectors
Label13.Caption = Bytes
Label14.Caption = freeClusters
Else
Label6.Caption = "Not Available"
Label12.Caption = "Not Available"
Label13.Caption = "Not Available"
Label14.Caption = "Not Available"
End If
retValue = GetCurrentDirectory(255, buffer)
Label7.Caption = buffer
retValue = GetWindowsDirectory(buffer, 255)
Label8.Caption = buffer

حيث أن :
Free Disk Space 6
Current Directory: 7
Free Sectors: 12
Bytes/Sector:: 13
Clusters: 14
}}}
تم الشكر بواسطة:


الردود في هذا الموضوع
كود لمعرفة جميع ال Drivers الموجودة في جهاز الكومبيوتر - بواسطة Raggi Tech - 17-10-12, 12:50 AM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم