Icons in shell32.dll

  • Die Icons aus der shell32 sollte man dann nehmen, wenn die Icons gleich wie im übrigen Windows aussehen sollen :). Wenn das nicht wichtig ist, sind eigene Iconpacks sicher die bessere Wahl.

    • Offizieller Beitrag

    Hattest du nicht auch mal dies gemacht?

    Spoiler anzeigen
    [autoit]

    #include<GUIConstants.au3>
    ;===============================================================================
    ;
    ; Description: Show all icons in the given file and choose one.
    ; Requirement(s): Autoit 3.2.5+
    ; Author(s): Prog@ndy (some Functions and Gui-Style by YDY (Lazycat) (in enumicons_v2))
    ; Version: 1.0
    ; Date: 02.11.2007
    ;
    ; How to Call: $ret = _ChooseIcon( [Optional: Filename] )
    ; Return Values: Array:
    ; [0] = FileName
    ; [1] = Icon Number
    ;
    ;===============================================================================
    Global $_CI_StartIndex, $_CI_IconCount, $_CI_FileName, $_CI_SelectedIconName
    Global $_CI_hFileSel, $_CI_hGui, $_CI_hFile, $_CI_Next, $_CI_Back, $_CI_OK, $_CI_Icon, $_CI_hStatus, $_CI_IconRadios[30], $_CI_Labels[30] ;Gui-Variables
    $_CI_StartIndex = 1
    Global $_CI_oldEventMode
    #cs Example
    $ret = _ChooseIcon()
    MsgBox(0,"Icon","Pfad: " & $ret[0] & @CRLF & "icon-Nr.: " & $ret[1])
    #ce

    [/autoit] [autoit][/autoit] [autoit]

    $ret = _ChooseIcon()
    MsgBox(0,"Icon","Pfad: " & $ret[0] & @CRLF & "icon-Nr.: " & $ret[1])

    [/autoit] [autoit][/autoit] [autoit]

    Func _ChooseIcon($fFileName = "")

    [/autoit] [autoit][/autoit] [autoit]

    $_CI_oldEventMode = Opt("GuiOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    If FileExists($fFileName) Then
    $_CI_FileName = $fFileName
    Else
    $_CI_FileName = @SystemDir & "\shell32.dll"
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $_CI_hGui = GUICreate("Icon Selector by Ordinal value", 385, 450, -1, -1, -1, $WS_EX_ACCEPTFILES)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CI_CloseFunc")
    GUICtrlCreateGroup("", 5, 1, 375, 40)
    GUICtrlCreateGroup("", 5, 50, 375, 350)
    $_CI_hFile = GUICtrlCreateInput($_CI_FileName, 12, 15, 325, 16, -1, $WS_EX_STATICEDGE)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED)
    GUICtrlSetTip(-1, "You can drop files from shell here...")
    $_CI_hStatus = GUICtrlCreateInput("", 90, 49, 200, 16, $ES_READONLY, $WS_EX_STATICEDGE)
    $_CI_hFileSel = GUICtrlCreateButton("...", 345, 14, 26, 18)
    GUICtrlSetOnEvent(-1, "_CI_LoadButton")
    $_CI_Next = GUICtrlCreateButton("&Weiter -|>", 310, 410)
    GUICtrlSetOnEvent(-1, "_CI_Next")
    $_CI_Back = GUICtrlCreateButton("<|- &Zurück", 20, 410)
    GUICtrlSetOnEvent(-1, "_CI_Back")
    $_CI_OK = GUICtrlCreateButton("Icon wählen:", 120, 410)
    GUICtrlSetOnEvent(-1, "_CI_CloseFunc")
    GUICtrlSetState(-1, $GUI_DISABLE)
    $_CI_Icon = GUICtrlCreateIcon("", 0, 190, 404, 32, 32)

    For $iCntRow = 0 To 4
    For $iCntCol = 0 To 5
    $iCurIndex = $iCntRow * 6 + $iCntCol
    $_CI_IconRadios[$iCurIndex] = GUICtrlCreateRadio("", 55 * $iCntCol + 25, 65 * $iCntRow + 75, 45, 45, $BS_ICON + $BS_PUSHLIKE)
    GUICtrlSetImage(-1, @SystemDir & "\shell32.dll", -2)
    ;$ahIcons[$iCurIndex] = GUICtrlCreateIcon($glFilename, 0, 60 * $iCntCol + 25, 70 * $iCntRow + 80)
    GUICtrlSetOnEvent(-1, "_CI_SelectedIcon")
    $_CI_Labels[$iCurIndex] = GUICtrlCreateLabel("1", 55 * $iCntCol + 12, 65 * $iCntRow + 120, 58, 20, $SS_CENTER)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    Next
    Next

    _CI_NewFileLoad($_CI_FileName)
    GUISetState() ; will display an dialog box with 1 checkbox
    ; Run the GUI until the dialog is closed
    While WinExists($_CI_hGui)
    Sleep(100)
    WEnd
    Local $arTemp[2] = [$_CI_FileName, $_CI_SelectedIconName]
    Return $arTemp
    EndFunc ;==>_ChooseIcon

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_Next()
    If $_CI_StartIndex + 30 <= $_CI_IconCount Then $_CI_StartIndex += 30
    If $_CI_StartIndex + 30 > $_CI_IconCount Then
    GUICtrlSetState($_CI_Next, $GUI_DISABLE)
    EndIf
    GUICtrlSetState($_CI_Back, $GUI_ENABLE)
    _CI_Update()
    EndFunc ;==>_CI_Next

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_Back()
    If $_CI_StartIndex - 30 >= 0 Then $_CI_StartIndex -= 30
    If $_CI_StartIndex - 30 < 0 Then
    GUICtrlSetState($_CI_Back, $GUI_DISABLE)
    EndIf
    GUICtrlSetState($_CI_Next, $GUI_ENABLE)
    _CI_Update()
    EndFunc ;==>_CI_Back

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_Update()
    For $iCntRow = 0 To 4
    For $iCntCol = 0 To 5
    $iCurIndex = $iCntRow * 6 + $iCntCol
    If ($iCurIndex + $_CI_StartIndex) > $_CI_IconCount Then
    GUICtrlSetState($_CI_IconRadios[$iCurIndex], $GUI_HIDE)
    GUICtrlSetState($_CI_Labels[$iCurIndex], $GUI_HIDE)
    Else
    GUICtrlSetState($_CI_IconRadios[$iCurIndex], $GUI_SHOW)
    GUICtrlSetState($_CI_Labels[$iCurIndex], $GUI_SHOW)
    GUICtrlSetState($_CI_IconRadios[$iCurIndex], $GUI_UNCHECKED)
    GUICtrlSetImage($_CI_IconRadios[$iCurIndex], $_CI_FileName, -($_CI_StartIndex + $iCurIndex))
    GUICtrlSetData($_CI_Labels[$iCurIndex], -($_CI_StartIndex + $iCurIndex))
    If - ($_CI_StartIndex + $iCurIndex) = $_CI_SelectedIconName Then GUICtrlSetState($_CI_IconRadios[$iCurIndex], $GUI_CHECKED)
    EndIf
    Next
    Next
    GUICtrlSetData($_CI_hStatus, "Icons " & $_CI_StartIndex & "-" & _CI_MyMin(($_CI_StartIndex + 29), $_CI_IconCount) & " von " & $_CI_IconCount & " | Seite " & Ceiling(($_CI_StartIndex) / 30) & "von " & Ceiling($_CI_IconCount / 30))
    EndFunc ;==>_CI_Update

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_CloseFunc()
    GUIDelete($_CI_hGui)
    Opt("GuiOnEventMode", $_CI_oldEventMode)
    EndFunc ;==>_CI_CloseFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_SelectedIcon()
    For $i = 0 To 29
    If $_CI_IconRadios[$i] = @GUI_CtrlId Then
    $_CI_SelectedIconName = 1 * GUICtrlRead($_CI_Labels[$i])
    GUICtrlSetImage($_CI_Icon, $_CI_FileName, $_CI_SelectedIconName)
    GUICtrlSetState($_CI_OK, $GUI_ENABLE)
    ExitLoop
    EndIf
    Next
    EndFunc ;==>_CI_SelectedIcon

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_LoadButton()
    Return _CI_NewFileLoad(FileOpenDialog("Select Icon file:", GUICtrlRead($_CI_hFile), "Icon-Files (*.exe;*.dll;*.ocx;*.icl;*.ico)"))
    EndFunc ;==>_CI_LoadButton

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_NewFileLoad($sTmpFile)
    If Not FileExists($sTmpFile) Then Return 0
    If @error Then Return 0
    $glFileName = $sTmpFile
    GUICtrlSetData($_CI_hFile, $glFileName)
    $_CI_iStartIndex = 1
    $_CI_IconCount = _GetIconCount($sTmpFile)
    For $i = 0 To 29
    GUICtrlSetImage($_CI_IconRadios[$i], $_CI_FileName, -($i + $_CI_iStartIndex))
    GUICtrlSetState($_CI_IconRadios[$i], $GUI_UNCHECKED)
    GUICtrlSetData($_CI_Labels[$i], -($i + $_CI_iStartIndex))
    Next
    GUICtrlSetData($_CI_hStatus, "Icons 1 - 30 von " & $_CI_IconCount & " | Seite 1 von " & Ceiling($_CI_IconCount / 30))
    ;Return 1
    GUICtrlSetState($_CI_Back, $GUI_DISABLE)
    GUICtrlSetState($_CI_OK, $GUI_DISABLE)
    _CI_Update()
    EndFunc ;==>_CI_NewFileLoad

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; Function by YDY (Lazycat)
    Func _GetIconCount($sFilename)
    Local $iCount = DllCall("Shell32", "int", "ExtractIconEx", "str", $sFilename, "int", -1, "ptr", 0, "ptr", 0, "int", 1)
    If Not @error Then Return $iCount[0]
    Return 0
    EndFunc ;==>_GetIconCount

    [/autoit] [autoit][/autoit] [autoit]

    Func _CI_MyMin($1, $2)
    If Number($1) < Number($2) Then
    Return Number($1)
    Else
    Return Number($2)
    EndIf
    EndFunc ;==>_CI_MyMin

    [/autoit]

    Mega

    • Offizieller Beitrag

    Hallo

    Falls du den Total Commander benutzt (*schwärm*^^), dann gibt das Plugin "IclView" auf der Pluginseite für den Lister.
    Damit kannst du aus *.ico, *.exe, *.dll, *.icl,... Dateien, Icons dir angucken, und ggf auch direkt als Icon extrahieren, oder als icl Datei (die du Natürlich selbst definieren kannst) speichern.

    Mfg Spider

    • Offizieller Beitrag

    @Xeno: Ja, ich habe jetzt die Icons aus einem Iconpack. Etwas nachbearbeitet. Danke, für den Tip. :)

    @progandy: Dein Script habe ich und benutze es auch. Sehr Hilfreich!

    GtaSpider : Der TotalCommander ist mein absolutes Lieblingsprogramm. Läuft immer im Hintergrund. IclView kannte ich aber noch nicht. Danke!

    @Ritzelrocker: Die Icons aus der 'Progman.exe' sind irgendwie nicht so der Brüller. Etwas....veraltet... ;)

    eukalyptus: Igitt! Vista! Bäh! :D

    Zum umwandeln eines Bilds in ein Icon kann man auch IrfanView benutzen. Mache ich immer so.

    • Offizieller Beitrag

    Hallo,

    einer der besten Freeware Icon-Editoren die ich kenne ist IcoFX.