Determines if a file's registered content type matches the specified content type.
#Include <WinAPIEx.au3>
_WinAPI_PathIsContentType ( $sPath, $sType )
$sPath | The file whose content type will be compared. |
$sType | The content type string. For example, "application/x-msdownload", "image/jpeg", "text/plain", etc. |
Success | 1 - The file's content type matches the specified content type. |
0 | Otherwise. |
失败: | 返回 0 并设置 @error 标志为非 0 值. |
在MSDN中搜索
#Include <Array.au3>
#Include <File.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $FileList = _FileListToArray(@SystemDir, '*.*', 1)
Global $SortList[UBound($FileList) - 1]
Global $Count = 0
For $i = 1 To $FileList[0]
If _WinAPI_PathIsContentType($FileList[$i], 'text/xml') Then
$SortList[$Count] = $FileList[$i]
$Count += 1
EndIf
Next
If $Count Then
ReDim $SortList[$Count]
Else
Exit
EndIf
_ArrayDisplay($SortList, '_WinAPI_PathIsContentType')