函数参考


_WinAPI_FindNextFileName

Continues enumerating the hard links.

#Include <WinAPIEx.au3>
_WinAPI_FindNextFileName ( $hSearch, ByRef $sLink )

参数

$hSearch A handle to the enumeration that is returned by a successful call to _WinAPI_FindFirstFileName() function.
$sLink The next link name that was found.

返回值

成功: 返回 1.
失败: 返回 0 并设置 @error 标志为非 0 值, @extended 标志可能包含一个系统错误代码.

注意/说明

If the function fails because no matching files can be found,, the @extended flag will contain ERROR_HANDLE_EOF (38)
system error code.

本函数需要 Windows Vista 或更高版本系统.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <Array.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global Const $sFile = @DesktopDir & '\@' & StringRegExpReplace(_WinAPI_PathFindFileName(@ScriptName), '\A_+', '')

Global $hSearch, $sLink

; Create hard link to the current file with prefix "@" on your Desktop
_WinAPI_CreateHardLink($sFile, @ScriptFullPath)
If @error Then
    MsgBox(16, 'Error', 'Unable to create hard link.')
    Exit
EndIf

; Enumerate all hard links to the file

$hSearch = _WinAPI_FindFirstFileName($sFile, $sLink)
While Not @error
    ConsoleWrite(_WinAPI_PathAppend(_WinAPI_PathStripToRoot($sFile), $sLink) & @CR)
    _WinAPI_FindNextFileName($hSearch, $sLink)
WEnd

Switch @extended
    Case 38 ; ERROR_HANDLE_EOF

    Case Else
        MsgBox(16, @extended, _WinAPI_GetErrorMessage(@extended))
EndSwitch

FileDelete($sFile)