如何获得临时文件的所有属性
Temporary Internet Files文件夹下的文件。将该文件夹视图设为【详细信息】,便可以知道了题目的要求。现在,要获得除名称以外的属性,如何做呢? #include <Date.au3>Const $tagCache = "dword;ptr;dword;dword;dword;dword;dword;ptr;dword;ptr"
Dim $hFind = _FindFirstUrlCacheEntry()
FileWrite("TempFile.txt", "TempInternetFiles" & @CRLF)
While True
$aCache = _FindNextUrlCacheEntry($hFind)
If @error Then ExitLoop
For $o = 0 to Ubound($aCache) - 1
FileWrite("TempFile.txt", $aCache[$o] & @CRLF)
Next
FileWrite("TempFile.txt", @CRLF)
WEnd
ShellExecute("TempFile.txt")
Func _FindFirstUrlCacheEntry()
Local $tCache, $pCache, $hFind
$hFind = DllCall("Wininet.dll", "hWnd", "FindFirstUrlCacheEntry", _
"str", "", "ptr", 0, "int*", 0)
$tCache = DllStructCreate("ubyte[" & $hFind & "]")
$pCache = DllStructGetPtr($tCache)
$hFind = DllCall("Wininet.dll", "hWnd", "FindFirstUrlCacheEntry", _
"str", "", "ptr", $pCache, "int*", $hFind)
$tCache = 0
Return $hFind
EndFunc ;==>_FindFirstUrlCacheEntry()
Func _FindNextUrlCacheEntry(ByRef $hFind)
Local $tBuffer, $pBuffer, $iSizeofBuffer, $tCache, $iResult
$iResult = DllCall("Wininet.dll", "int", "FindNextUrlCacheEntry", _
"hWnd", $hFind, "ptr", 0, "int*", 0)
$iSizeofBuffer = $iResult
$tBuffer = DllStructCreate("ubyte[" & $iSizeofBuffer & "]")
$pBuffer = DllStructGetPtr($tBuffer)
$iResult = DllCall("Wininet.dll", "int", "FindNextUrlCacheEntry", _
"hWnd", $hFind, "ptr", $pBuffer, "int*", $iSizeofBuffer)
If Not $iResult Then Return SetError(259, 0, 0)
Local $tCache, $tSrcUrl, $tLocalFile, $aResult, $sFileExt
$tCache = DllStructCreate($tagCache, $pBuffer)
$tSrcUrl = DllStructCreate("char", DllStructGetData($tCache, 2, 1))
$tLocalFile = DllStructCreate("char", DllStructGetData($tCache, 2, 2))
$aResult = DllStructGetData($tLocalFile, 1)
$aResult = DllStructGetData($tSrcUrl, 1)
$sFileExt = StringRegExp($aResult, "\.([^\.]+$)", 3)
If IsArray($sFileExt) Then
$aResult = $sFileExt & " File"
Else
$aResult = "Unknown File"
EndIf
$aResult = DllStructGetData($tCache, 3, 1)
$aResult = DllStructGetData($tCache, 3, 2)
$aResult = DllStructGetData($tCache, 3, 3)
$aResult = _FormatTime(DllStructGetPtr($tCache, 4))
$aResult = _FormatTime(DllStructGetPtr($tCache, 5))
$aResult = _FormatTime(DllStructGetPtr($tCache, 6))
$aResult = _FormatTime(DllStructGetPtr($tCache, 7))
$tBuffer = 0
$tCache = 0
$tSrcURL = 0
$tFileExt = 0
$tLocalFile = 0
Return SetError(Not $iResult, 0, $aResult)
EndFunc ;==>_FindNextUrlCacheEntry()
Func _FormatTime($pTime)
Local $tSysTime
$tSysTime = _Date_Time_FileTimeToSystemTime($pTime)
Return _Date_Time_SystemTimeToDateTimeStr($tSysTime)
EndFunc ;==>_FormatTime()
页:
[1]