程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> Visual Basic語言 >> VB綜合教程 >> 取得Disk Volume Information

取得Disk Volume Information

編輯:VB綜合教程

  

Private Declare Function GetVolumeInformation Lib "kernel32" _
  Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, _
  ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, _
  lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, _
  lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, _
  ByVal nFileSystemNameSize As Long) As Long
Const FILE_VOLUME_IS_COMPRESSED = &H8000
Public Sub GetVolInfo(Byval Path as String)
Dim aa As Long
Dim VolName As String
Dim fsysName As String
Dim path As String
Dim VolSeri As Long, compress As Long
Dim Sysflag As Long, Maxlen As Long
VolName = String(255, 0)
fsysName = String(255, 0)
aa = GetVolumeInformation(path, VolName, 256, VolSeri, Maxlen, _
  Sysflag, fsysName, 256)
VolName = Left(VolName, InStr(1, VolName, Chr(0)) - 1)
fsysName = Left(fsysName, InStr(1, fsysName, Chr(0)) - 1)
compress = Sysflag And FILE_VOLUME_IS_COMPRESSED
If compress = 0 Then
  Debug.Print "非Compress之Volume"
Else
  Debug.Print "Compress之Volume"
End If
Debug.Print "Volume Name :", VolName
Debug.Print "Volume Serical# : ", Hex(VolSeri)
Debug.Print "Name of the file system (such as FAT, HPFS, or NTFS)", fsysName
Debug.Print "Max Length of File Name ", Maxlen
End Sub
Private Sub Command1_Click()
  Call GetVolInfo("c:\")
End sub

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved