Continues a file or directory search.
#Include <WinAPIEx.au3>
_WinAPI_FindNextFile ( $hSearch, $pData )
$hSearch | The search handle returned by a previous call to the _WinAPI_FindFirstFile() function. |
$pData | A pointer to the $tagWIN32_FIND_DATA structure that receives information about a found file or directory. |
成功: | 返回 1. |
失败: | 返回 0 并设置 @error 标志为非 0 值, @extended 标志可能包含一个系统错误代码. |
在MSDN中搜索
#Include <Array.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $tData, $pData, $hSearch, $File
Global $List[101][2] = [[0]]
$tData = DllStructCreate($tagWIN32_FIND_DATA)
$pData = DllStructGetPtr($tData)
$hSearch = _WinAPI_FindFirstFile(@ScriptDir & '\*', $pData)
While Not @error
$File = DllStructGetData($tData, 'cFileName')
Switch $File
Case '.', '..'
Case Else
If Not BitAND(DllStructGetData($tData, 'dwFileAttributes'), $FILE_ATTRIBUTE_DIRECTORY) Then
$List[0][0] += 1
If $List[0][0] > UBound($List) - 1 Then
ReDim $List[UBound($List) + 100][2]
EndIf
$List[$List[0][0]][0] = $File
$List[$List[0][0]][1] = _WinAPI_MakeQWord(DllStructGetData($tData, 'nFileSizeLow'), DllStructGetData($tData, 'nFileSizeHigh'))
EndIf
EndSwitch
_WinAPI_FindNextFile($hSearch, $pData)
WEnd
Switch @extended
Case 18 ; ERROR_NO_MORE_FILES
Case Else
MsgBox(16, @extended, _WinAPI_GetErrorMessage(@extended))
Exit
EndSwitch
_WinAPI_FindClose($hSearch)
_ArrayDisplay($List, '_WinAPI_Find...', $List[0][0])