1,486
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * 260
cAlternate As String * 14
End Type
Const INVALID_HANDLE_VALUE = -1
Private Sub Command1_Click()
'查找文件的过程
Dim FileHandle& '存储句柄
Dim FileName1$ '存储返回的文件名
Dim nFindFileData As WIN32_FIND_DATA
Dim FileStatu&
FileStatu& = FindFirstFile(Text1.Text, nFindFileData) '
If FileHandle& <> INVALID_HANDLE_VALUE Then
FileName1$ = nFindFileData.cAlternate
MsgBox "文件的短文件名:" & FileName1$
Else
MsgBox "文件不存在!"
End If
End Sub
Private Sub Form_Load()
Text1.Text = "\\?\D:\1234."
End Sub