#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=C:\Program Files (x86)\AutoIt3\Icons\au3.ico #AutoIt3Wrapper_Outfile_x64=enumicons.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Fileversion=2.1.0.1 #AutoIt3Wrapper_Res_ProductVersion=2.1.0.1 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Res_Field=Compiled with | AutoIt Version 3.3.18.0 #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% #AutoIt3Wrapper_Res_Field=Compile date|%longdate% %time% #AutoIt3Wrapper_Run_After=del "%scriptfile%_stripped.au3" #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.18.0 Author: YDY (Lazycat) Modified: Jon, Jpm Script Function: Show all icons in the given file #ce ---------------------------------------------------------------------------- #Region ### Version History #cs ---------------------------------------------------------------------------- Version History 2.1.0.1 (2025/10/13) Updated: simplification by wakillon 2.1.0.0 (2021/12/06) Added: Scrollbar and optimisation of by name 2.0.1.0 (2007/11/14) Updated: simplification by Jon 2.0.0.0 (2007/08/02) Updated: use DllCallback.au3 1.0.0.0 (2006/06/20) Added: Initial version #ce ---------------------------------------------------------------------------- #EndRegion ### Version History #Region ;************ Includes ************ #include #include #include #include #Include #EndRegion ;************ Includes ************ Opt('MustDeclareVars', 1) #Region ------ Global Variables ------------------------------ Global $sGuiTitle = 'Icon Selector by Name value - v2.1.0.1' Global $aIdIcons[30], $aIdLabels[30], $aIconsNames Global $hGui, $idButtonPrev, $idButtonNext, $idButtonFileSelect, $idButtonMode, $idComboDll, $idLabelIconCount, $iMsg Global $sFilePath = @SystemDir & '\shell32.dll', $sNewFilePath Global $iStartIndex = 1, $bOrdinal = True, $iIconsCount #EndRegion --- Global Variables ------------------------------ _Gui() #Region ------ Main Loop ------------------------------ While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $idButtonFileSelect $sNewFilePath = FileOpenDialog("Select file:", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", "File (*.exe;*.dll;*.ocx;*.icl)", 0, '', $hGui) If @error Then ContinueLoop If $sNewFilePath <> $sFilePath Then $iStartIndex = 1 $sFilePath = $sNewFilePath $iIconsCount = _IconsGetCount($sFilePath) GUICtrlSetData($idLabelIconCount, _FileGetName($sFilePath) & ' : ' & $iIconsCount & ' icons') If $iIconsCount < UBound($aIdIcons) +1 Then GUICtrlSetState($idButtonNext, $GUI_DISABLE) GUICtrlSetState($idButtonPrev, $GUI_DISABLE) Else GUICtrlSetState($idButtonNext, $GUI_ENABLE) EndIf $aIconsNames = _WinAPI_EnumResourceNames($sFilePath, $RT_GROUP_ICON) _GuiUpdate() EndIf Case $idButtonPrev $iStartIndex -= UBound($aIdIcons) _GuiUpdate() Case $idButtonNext $iStartIndex += UBound($aIdIcons) _GuiUpdate() Case $idButtonMode If $bOrdinal = False Then $bOrdinal = True GUICtrlSetData($idButtonMode, 'by Name') WinSetTitle($hGui, '', $sGuiTitle) If $iStartIndex > $iIconsCount Then $iStartIndex = 1 Else $bOrdinal = False GUICtrlSetData($idButtonMode, 'by Ordinal') WinSetTitle($hGui, '', $sGuiTitle) If $iStartIndex > $iIconsCount Then $iStartIndex = 1 EndIf _GuiUpdate() Case $idComboDll $sNewFilePath = @SystemDir & '\' & GUICtrlRead($idComboDll) If $sNewFilePath <> $sFilePath Then $iStartIndex = 1 $sFilePath = $sNewFilePath $iIconsCount = _IconsGetCount($sFilePath) GUICtrlSetData($idLabelIconCount, _FileGetName($sNewFilePath) & ' : ' & $iIconsCount & ' icons') If $iIconsCount < 31 Then GUICtrlSetState($idButtonNext, $GUI_DISABLE) GUICtrlSetState($idButtonPrev, $GUI_DISABLE) Else GUICtrlSetState($idButtonNext, $GUI_ENABLE) EndIf $aIconsNames = _WinAPI_EnumResourceNames($sFilePath, $RT_GROUP_ICON) _GuiUpdate() EndIf Case $GUI_EVENT_DROPPED $sNewFilePath = @GUI_DragFile If $sNewFilePath <> $sFilePath Then $iStartIndex = 1 $sFilePath = $sNewFilePath $iIconsCount = _IconsGetCount($sFilePath) GUICtrlSetData($idLabelIconCount, _FileGetName($sFilePath) & ' : ' & $iIconsCount & ' icons') If $iIconsCount < UBound($aIdIcons) +1 Then GUICtrlSetState($idButtonNext, $GUI_DISABLE) GUICtrlSetState($idButtonPrev, $GUI_DISABLE) Else GUICtrlSetState($idButtonNext, $GUI_ENABLE) EndIf $aIconsNames = _WinAPI_EnumResourceNames($sFilePath, $RT_GROUP_ICON) _GuiUpdate() EndIf Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(10) WEnd #EndRegion --- Main Loop ------------------------------ Func _FileGetName($sFilePath) Local $aFileName = StringSplit($sFilePath, '\') If Not @error Then Return $aFileName[$aFileName[0]] Return $sFilePath EndFunc ;==> _FileGetName() Func _Gui() $hGui = GUICreate($sGuiTitle, 395, 435, @DesktopWidth/2 -192, @DesktopHeight/2 -235, $GUI_SS_DEFAULT_GUI, $WS_EX_ACCEPTFILES) GUICtrlCreateGroup('', 5, 1, 385, 40) GUICtrlCreateGroup('', 5, 50, 385, 380) $idComboDll = GUICtrlCreateCombo('shell32.dll', 12, 14, 140, 16) Local $sDllString = 'user32.dll|imageres.dll|netshell.dll|wmploc.dll|ddores.dll|mmcndmgr.dll|moricons.dll|ieframe.dll|compstui.dll|' & _ 'setupapi.dll|synccenter.dll|pifmgr.dll|dsuiext.dll|msihnd.dll|stobject.dll|rasgcw.dll|msctf.dll|mshtml.dll|msutb.dll|cryptui.dll|' & _ 'wiashext.dll|twinui.dll|rasdlg.dll|accessibilitycpl.dll|wpdshext.dll|sensorscpl.dll|ipsmsnap.dll|networkexplorer.dll|comres.dll|' & _ 'comdlg32.dll' Local $aDllString = StringSplit($sDllString, '|') For $i = 1 To UBound( $aDllString ) -1 If Not FileExists(@SystemDir & '\' & $aDllString[$i]) Then $sDllString = StringReplace($sDllString, $aDllString[$i], '' ); remove dll not existing Next GUICtrlSetData($idComboDll, $sDllString, 'shell32.dll') $iIconsCount = _IconsGetCount($sFilePath) $idLabelIconCount = GUICtrlCreateLabel('shell32.dll : ' & $iIconsCount & ' icons', 190, 16, 165, 16) $idButtonFileSelect = GUICtrlCreateButton('...', 360, 14, 26, 18) GUICtrlSetTip( -1, 'or Click for Select ', 'Drag a file', 1, 1) GUICtrlSetState(-1, $GUI_DROPACCEPTED) $idButtonPrev = GUICtrlCreateButton('Previous', 10, 45, 60, 24, $BS_FLAT) GUICtrlSetState(-1, $GUI_DISABLE) $idButtonNext = GUICtrlCreateButton('Next', 75, 45, 60, 24, $BS_FLAT) $idButtonMode = GUICtrlCreateButton('by Name', 300, 45, 60, 24, $BS_FLAT) Local $iCurrentIndex For $iRowCount = 0 To 4 For $iColomnCount = 0 To 5 $iCurrentIndex = $iRowCount*6 + $iColomnCount $aIdIcons[$iCurrentIndex] = GUICtrlCreateIcon($sFilePath, -($iCurrentIndex +1), 60*$iColomnCount +25, 70*$iRowCount +80) $aIdLabels[$iCurrentIndex] = GUICtrlCreateLabel(-($iCurrentIndex +1), 60*$iColomnCount +11, 70*$iRowCount +115, 60, 20, $SS_CENTER) Next Next $aIconsNames = _WinAPI_EnumResourceNames($sFilePath, $RT_GROUP_ICON) GUISetState() EndFunc ;==> _Gui() Func _GuiUpdate() GUISetState(@SW_DISABLE , $hGui) If $iIconsCount - $iStartIndex < UBound($aIdIcons) Then GUICtrlSetState($idButtonNext, $GUI_DISABLE) For $i = UBound($aIdIcons) -1 To $iIconsCount -$iStartIndex Step -1 If $i < 0 Then ExitLoop GUICtrlSetImage($aIdIcons[$i], $sFilePath, -2^16) ; delete icon GUICtrlSetData($aIdLabels[$i], '') Next Else GUICtrlSetState($idButtonNext, $GUI_ENABLE) EndIf If $iIconsCount Then Local $j = 0 For $i = $iStartIndex To $iStartIndex +UBound($aIdIcons) -1 GUICtrlSetImage($aIdIcons[$j], $sFilePath, -$i) If Not $bOrdinal Then If IsNumber($aIconsNames[$iStartIndex +$j]) Then GUICtrlSetFont($aIdLabels[$j], 8.5) GUICtrlSetTip( $aIdLabels[$j], '') Else If StringLen($aIconsNames[$iStartIndex +$j]) > 1 Then GUICtrlSetFont($aIdLabels[$j], 6) GUICtrlSetTip( $aIdLabels[$j], $aIconsNames[$iStartIndex +$j], 'Icon Name', 1, 1) EndIf EndIf GUICtrlSetData($aIdLabels[$j], '"' & $aIconsNames[$iStartIndex +$j] & '"') Else GUICtrlSetData($aIdLabels[$j], -($iStartIndex +$j)) GUICtrlSetFont($aIdLabels[$j], 8.5) GUICtrlSetTip( $aIdLabels[$j], '') EndIf $j+=1 If $j > $iIconsCount -$iStartIndex Then ExitLoop Next EndIf If $iStartIndex = 1 Then GUICtrlSetState($idButtonPrev, $GUI_DISABLE) Else GUICtrlSetState($idButtonPrev, $GUI_ENABLE) EndIf GUISetState(@SW_ENABLE , $hGui) EndFunc ;==> _GuiUpdate() Func _IconsGetCount($sFilePath) Local $aRet = DllCall('shell32.dll', 'uint', 'ExtractIconExW', 'wstr', $sFilePath, 'int', -1, 'struct*', 0, 'struct*', 0, 'uint', 0) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==> _IconsGetCount()