|
发表于 2014-2-9 13:45:14
|
显示全部楼层
本帖最后由 netegg 于 2014-2-9 15:05 编辑
[au3]Local $a[3]
$a[1] = '路径名不合法'
$a[2]= '路径名合法'
$str = @ScriptFullPath & " >> " & $a[_WinAPI_PathFileExists(@ScriptFullPath)+1] & @CRLF ; File.
$str &= """C:"" >> " & $a[_WinAPI_PathFileExists("""C:""")+1] & @CRLF ; Drive.
$str &= "C: >> " & $a[_WinAPI_PathFileExists("C:")+1] & @CRLF ; Drive.
$str &= @ProgramFilesDir & " >> " & $a[_WinAPI_PathFileExists(@ProgramFilesDir)+1] & @CRLF ; Directory.
$str &= """Z:File.txt"" >> " & $a[_WinAPI_PathFileExists("""Z:File.txt""")+1] & @CRLF ; Shouldn't exist!
$str &= "D:bank >> " & $a[_WinAPI_PathFileExists("D:bank")+1] & @CRLF
$str &= "L: >> " & $a[_WinAPI_PathFileExists("L:")+1] & @CRLF ;全/半角
MsgBox(0, '_WinAPI_PathFileExists', $str)
Func _WinAPI_PathFileExists($sFilePath)
Local $aReturn = DllCall('shlwapi.dll', 'int', 'PathFileExistsW', 'wstr', $sFilePath)
If @error Then
Return SetError(1, 0, 0)
EndIf
Return $aReturn[0]
EndFunc ;==>_WinAPI_PathFileExists
[/au3] |
|