函数参考


_WinAPI_GetFinalPathNameByHandleEx

Retrieves the final path of the specified file.

#Include <WinAPIEx.au3>
_WinAPI_GetFinalPathNameByHandleEx ( $hFile [, $iFlags] )

参数

$hFile Handle to a file or directory.
$iFlags [可选参数] The type of result to return. This parameter can be combination of one $FILE_NAME_* and one
$VOLUME_NAME_* values.

$FILE_NAME_NORMALIZED
$FILE_NAME_OPENED

$VOLUME_NAME_DOS
$VOLUME_NAME_GUID
$VOLUME_NAME_NONE
$VOLUME_NAME_NT

返回值

Success The path of the file.
Failure Empty string and sets the @error flag to non-zero.

注意/说明

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

相关

详情参考

在MSDN中搜索


示例/演示


#Include <APIConstants.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

If _WinAPI_GetVersion() < '6.0' Then
    MsgBox(16, 'Error', 'Require Windows Vista or later.')
    Exit
EndIf

Global $hFile

$hFile = _WinAPI_CreateFile(@ScriptFullPath, 2, 0, 6)

ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile) & @CR)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_GUID) & @CR)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_NT) & @CR)
ConsoleWrite(_WinAPI_GetFinalPathNameByHandleEx($hFile, $VOLUME_NAME_NONE) & @CR)

_WinAPI_CloseHandle($hFile)