Dim $szDrive, $szDir, $szFName, $szExt, $ico = "", $tem, $icc = 0, $cc
$filename = _PathSplit($p & $flist[$i], $szDrive, $szDir, $szFName, $szExt)
if $filename[4] = ".lnk" Then
$tinfo = FileGetShortcut($p & $flist[$i])
if FileExists($tinfo[0]) then
$ico = $tinfo[4]
if FileExists($ico) then
$icc = $tinfo[5]
Else
$ico = $tinfo[0]
EndIf
EndIf
;~ Elseif $filename[4] = ".url" Then
;~ $tinfo = FileGetShortcut($p & $flist[$i])
;~ if StringInStr($tinfo[4], "") = 0 Then
;~ $ico = @SystemDir & "" & $tinfo[4]
;~ Else
;~ $ico = StringReplace(StringReplace($tinfo[4], "%ProgramFiles%", @ProgramFilesDir), "%SystemRoot%\system32", @SystemDir)
;~ EndIf
;~ if FileExists($ico) then
;~ $icc = $tinfo[5]
;~ Else
;~ $tem = RegRead("HKEY_CLASSES_ROOT" & $filename[4], "")
;~ if $tem <> "" Then
;~ $tem = RegRead("HKEY_CLASSES_ROOT" & $tem & "\DefaultIcon", "")
;~ if $tem <> "" Then
;~ $cc = StringInStr($tem, ",", 0, -1)
;~ if $cc > 0 Then
;~ $ico = StringLeft($tem, $cc - 1)
;~ if StringInStr($ico, "") = 0 Then
;~ $ico = @SystemDir & "" & $tinfo[4]
;~ Else
;~ $ico = StringReplace(StringReplace($ico, "%ProgramFiles%", @ProgramFilesDir), "%SystemRoot%\system32", @SystemDir)
;~ EndIf
;~ if FileExists($ico) = 0 then
;~ $ico = @SystemDir & "\user32.dll"
;~ $icc = 0
;~ Else
;~ $icc = Abs(StringTrimLeft($tem, $cc))
;~ EndIf
;~ Else
;~ $ico = @SystemDir & "\user32.dll"
;~ EndIf
;~ Else
;~ $ico = @SystemDir & "\user32.dll"
;~ EndIf
;~ Else
;~ $ico = @SystemDir & "\user32.dll"
;~ EndIf
;~ EndIf
Elseif $filename[4] = ".exe" Then
$ico = $p & $flist[$i]
Elseif $filename[4] = "" Then
$ico = @SystemDir & "\user32.dll"
Else
$tem = RegRead("HKEY_CLASSES_ROOT" & $filename[4], "")
;~ MsgBox(0, 0, $filename[4] & @CR & $tem)
if $tem <> "" Then
$tem = RegRead("HKEY_CLASSES_ROOT" & $tem & "\DefaultIcon", "")
;~ MsgBox(0, 0, $tem)
if $tem <> "" Then
$cc = StringInStr($tem, ",", 0, -1)
if $cc > 0 Then
$ico = StringLeft($tem, $cc - 1)
if StringInStr($ico, "") = 0 Then
$ico = @SystemDir & "" & $ico
Else
$ico = StringReplace(StringReplace($ico, "%ProgramFiles%", @ProgramFilesDir), "%SystemRoot%\system32", @SystemDir)
EndIf
if FileExists($ico) = 0 then
$ico = @SystemDir & "\user32.dll"
$icc = 0
Else
;~ if StringTrimLeft($tem, $cc) <= 0 Then
$icc = Abs(StringTrimLeft($tem, $cc))
;~ Else
;~ $icc = Abs(StringTrimLeft($tem, $cc))+1
;~ EndIf
EndIf
;~ MsgBox(0, 0, $ico & @CR & $icc)
Else
$ico = @SystemDir & "\user32.dll"
EndIf
Else
$ico = @SystemDir & "\user32.dll"
EndIf
Else
$ico = @SystemDir & "\user32.dll"
EndIf
EndIf
$ico是图标(库)文件,$icc是图标序号。