新建From1(窗体),新建Command1(按钮CommandButton),代码:
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
Public Function WhichFileSystem(ByVal Drive As String) As String
Dim sVolBuf As String * 255
Dim sSysName As String * 255
Dim lSerialNum As Long
Dim lSysFlags As Long
Dim lComponentLength As Long
Dim lRes As Long
lRes = GetVolumeInformation(Drive, sVolBuf, 255, lSerialNum, lComponentLength, lSysFlags, sSysName, 255)
If lRes Then
WhichFileSystem = Left$(sSysName, InStr(sSysName, Chr$(0)) - 1)
Else
WhichFileSystem = ""
End If
End Function
Private Sub Command1_Click()
MsgBox WhichFileSystem("C:\")
End Sub