2个回答
展开全部
需要用到API函数。
举例:在窗口中画一个文本框,叫做Text1,然后写代码如下:
Option Explicit
Private Declare Function GetVolumeInformation& Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long)
Const MAX_FILENAME_LEN = 256
Private Sub Form_Load()
Dim RetVal As Long
Dim str As String * MAX_FILENAME_LEN
Dim str2 As String * MAX_FILENAME_LEN
Dim A As Long
Dim B As Long
Me.Show
Call GetVolumeInformation("C:\", str, MAX_FILENAME_LEN, RetVal, A, B, str2, MAX_FILENAME_LEN)
Text1 = RetVal
End Sub
举例:在窗口中画一个文本框,叫做Text1,然后写代码如下:
Option Explicit
Private Declare Function GetVolumeInformation& Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal pVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long)
Const MAX_FILENAME_LEN = 256
Private Sub Form_Load()
Dim RetVal As Long
Dim str As String * MAX_FILENAME_LEN
Dim str2 As String * MAX_FILENAME_LEN
Dim A As Long
Dim B As Long
Me.Show
Call GetVolumeInformation("C:\", str, MAX_FILENAME_LEN, RetVal, A, B, str2, MAX_FILENAME_LEN)
Text1 = RetVal
End Sub
追问
你试过了吗?我这无法执行,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询