Frage

Ich würde gerne der Baum, Symbol für eine selbstentwickelte app.Weiß jemand, wie man extrahieren Sie die Bilder aus, die als .Symbol-Dateien?Ich möchte sowohl die 16x16 und 32x32, oder würde ich nur ein Standbild.

War es hilfreich?

Lösung

In Visual Studio, wählen Sie "Datei Öffnen..." und dann "Datei...".Dann wählen Sie die Shell32.dll.Eine Ordner-Struktur sollte geöffnet werden, und Sie werden finden die Symbole in der "Symbol" - Ordner.

So speichern Sie ein Symbol sind, können Sie mit der rechten Maustaste auf das Symbol in der Ordner-Struktur, und wählen Sie "Exportieren".

Andere Tipps

Wenn jemand sucht eine einfache Möglichkeit, nur mit 7zip zu entpacken shell32.dll und nach dem Ordner suchen .src/SYMBOL/

Eine andere option ist zu verwenden Sie ein tool wie ResourceHacker.Es behandelt weit mehr als nur Symbole als gut.Cheers!

Ich brauchte zu extrahieren Symbol #238 von shell32.dll und nicht möchten, downloaden Sie Visual Studio oder Resourcehacker, so fand ich ein paar PowerShell-Skripts von der Technet-Website (danke, John Grenfell und #https://social.technet.microsoft.com/Forums/windowsserver/en-US/16444c7a-ad61-44a7-8c6f-b8d619381a27/using-icons-in-powershell-scripts?forum=winserverpowershell), dass die Tat etwas ähnliches, und erstellt ein neues Skript (unten), um meine Bedürfnisse anzupassen.

Die Parameter habe ich eingegeben wurden (die Quelle DLL-Pfad, Ziel-Symbol-Datei-Namen und das Symbol-index innerhalb der DLL-Datei):

C:\Windows\System32\shell32.dll

C: emp estart.ico

238

Ich entdeckte die Symbol-index, die ich brauchte, war #238 von Versuch und Irrtum, indem Sie vorübergehend erstellen Sie eine neue Verknüpfung (mit der rechten Maustaste auf Ihren desktop und wählen Sie Neu - > Verknüpfung und geben Sie calc ein und drücken Sie zweimal die EINGABETASTE).Dann rechts-klicken Sie auf die neue Verknüpfung und wählen Sie Eigenschaften und klicken Sie auf "Symbol Ändern" - button in der Registerkarte Verknüpfung.Fügen Sie im Pfad C:\Windows\System32\shell32.dll und klicken Sie auf OK.Finden Sie das Symbol, das Sie verwenden möchten, und arbeiten aus seinem index.NB:Index #2 ist unterhalb der #1 und nicht zu Ihrem Recht.Symbol index #5 wurde an der Spitze der Spalte, die zwei auf meinem Windows 7 x64-Maschine.

Wenn jemand eine bessere Methode, die funktioniert in ähnlicher Weise aber erhält höhere Qualität Ikonen dann wäre ich interessiert, davon zu hören.Vielen Dank, Shaun.

#Windows PowerShell Code###########################################################################
# http://gallery.technet.microsoft.com/scriptcenter/Icon-Exporter-e372fe70
#
# AUTHOR: John Grenfell
#
###########################################################################

<#
.SYNOPSIS
   Exports an ico and bmp file from a given source to a given destination
.Description
   You need to set the Source and Destination locations. First version of a script, I found other examples but all I wanted to do as grab and ico file from an exe but found getting a bmp useful. Others might find useful
   No error checking I'm afraid so make sure your source and destination locations exist!
.EXAMPLE
    .\Icon_Exporter.ps1
.Notes
        Version HISTORY:
        1.1 2012.03.8
#>
Param ( [parameter(Mandatory = $true)][string] $SourceEXEFilePath,
        [parameter(Mandatory = $true)][string] $TargetIconFilePath
)
CLS
#"shell32.dll" 238
If ($SourceEXEFilePath.ToLower().Contains(".dll")) {
    $IconIndexNo = Read-Host "Enter the icon index: "
    $Icon = [System.IconExtractor]::Extract($SourceEXEFilePath, $IconIndexNo, $true)    
} Else {
    [void][Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    $image = [System.Drawing.Icon]::ExtractAssociatedIcon("$($SourceEXEFilePath)").ToBitmap()
    $bitmap = new-object System.Drawing.Bitmap $image
    $bitmap.SetResolution(72,72)
    $icon = [System.Drawing.Icon]::FromHandle($bitmap.GetHicon())
}
$stream = [System.IO.File]::OpenWrite("$($TargetIconFilePath)")
$icon.save($stream)
$stream.close()
Write-Host "Icon file can be found at $TargetIconFilePath"

Ressourcen Extrahieren ist ein weiteres tool, das rekursiv suchen Sie Symbole aus einer Menge von DLLs, sehr praktisch, IMO.

Hier ist eine aktualisierte version des eine Lösung vor.Ich habe eine fehlende Montage, die war begraben in einem link.Anfänger nicht verstehen.In diesem Beispiel wird ausgeführt, ohne änderungen.

    <#
.SYNOPSIS
    Exports an ico and bmp file from a given source to a given destination
.Description
    You need to set the Source and Destination locations. First version of a script, I found other examples 
    but all I wanted to do as grab and ico file from an exe but found getting a bmp useful. Others might find useful
.EXAMPLE
    This will run but will nag you for input
    .\Icon_Exporter.ps1
.EXAMPLE
    this will default to shell32.dll automatically for -SourceEXEFilePath
    .\Icon_Exporter.ps1 -TargetIconFilePath 'C:\temp\Myicon.ico' -IconIndexNo 238
.EXAMPLE
    This will give you a green tree icon (press F5 for windows to refresh Windows explorer)
    .\Icon_Exporter.ps1 -SourceEXEFilePath 'C:/Windows/system32/shell32.dll' -TargetIconFilePath 'C:\temp\Myicon.ico' -IconIndexNo 41

.Notes
    Based on http://stackoverflow.com/questions/8435/how-do-you-get-the-icons-out-of-shell32-dll Version 1.1 2012.03.8
    New version: Version 1.2 2015.11.20 (Added missing custom assembly and some error checking for novices)
#>
Param ( 
    [parameter(Mandatory = $true)]
    [string] $SourceEXEFilePath = 'C:/Windows/system32/shell32.dll',
    [parameter(Mandatory = $true)]
    [string] $TargetIconFilePath,
    [parameter(Mandatory = $False)]
    [Int32]$IconIndexNo = 0
)

#https://social.technet.microsoft.com/Forums/windowsserver/en-US/16444c7a-ad61-44a7-8c6f-b8d619381a27/using-icons-in-powershell-scripts?forum=winserverpowershell
$code = @"
using System;
using System.Drawing;
using System.Runtime.InteropServices;

namespace System
{
    public class IconExtractor
    {

     public static Icon Extract(string file, int number, bool largeIcon)
     {
      IntPtr large;
      IntPtr small;
      ExtractIconEx(file, number, out large, out small, 1);
      try
      {
       return Icon.FromHandle(largeIcon ? large : small);
      }
      catch
      {
       return null;
      }

     }
     [DllImport("Shell32.dll", EntryPoint = "ExtractIconExW", CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
     private static extern int ExtractIconEx(string sFile, int iIndex, out IntPtr piLargeVersion, out IntPtr piSmallVersion, int amountIcons);

    }
}
"@

If  (-not (Test-path -Path $SourceEXEFilePath -ErrorAction SilentlyContinue ) ) {
    Throw "Source file [$SourceEXEFilePath] does not exist!"
}

[String]$TargetIconFilefolder = [System.IO.Path]::GetDirectoryName($TargetIconFilePath) 
If  (-not (Test-path -Path $TargetIconFilefolder -ErrorAction SilentlyContinue ) ) {
    Throw "Target folder [$TargetIconFilefolder] does not exist!"
}

Try {
    If ($SourceEXEFilePath.ToLower().Contains(".dll")) {
        Add-Type -TypeDefinition $code -ReferencedAssemblies System.Drawing
        $form = New-Object System.Windows.Forms.Form
        $Icon = [System.IconExtractor]::Extract($SourceEXEFilePath, $IconIndexNo, $true)    
    } Else {
        [void][Reflection.Assembly]::LoadWithPartialName("System.Drawing")
        [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
        $image = [System.Drawing.Icon]::ExtractAssociatedIcon("$($SourceEXEFilePath)").ToBitmap()
        $bitmap = new-object System.Drawing.Bitmap $image
        $bitmap.SetResolution(72,72)
        $icon = [System.Drawing.Icon]::FromHandle($bitmap.GetHicon())
    }
} Catch {
    Throw "Error extracting ICO file"
}

Try {
    $stream = [System.IO.File]::OpenWrite("$($TargetIconFilePath)")
    $icon.save($stream)
    $stream.close()
} Catch {
    Throw "Error saving ICO file [$TargetIconFilePath]"
}
Write-Host "Icon file can be found at [$TargetIconFilePath]"

Öffnen Sie einfach die DLL mit IrfanView und speichern Sie das Ergebnis als .gif oder .jpg.

Ich weiß, diese Frage ist alt, aber es ist das zweite google-Treffer von "extrahiert Icons aus dll", wollte ich vermeiden etwas zu installieren auf meinem Arbeitsplatz und ich erinnerte mich, ich IrfanView.

Sie können download freeware Resource Hacker und dann Folgen Sie den untenstehenden Anweisungen :

  1. Öffnen Sie eine beliebige dll-Datei, die Sie möchten, finden die Symbole aus.
  2. Ordner durchsuchen, um spezifische Symbole.
  3. Aus der Menüleiste, wählen Sie "Aktion" und dann auf "speichern".
  4. Wählen Sie Reiseziel für .ico-Datei.

Referenz : http://techsultan.com/how-to-extract-icons-from-windows-7/

Wenn Sie auf Linux sind, können Sie extrahieren icons aus einer Windows-DLL mit gExtractWinIcons.Es ist verfügbar in Ubuntu und Debian in das gextractwinicons Paket.

Dieser blog-Artikel ist eine Abbildung und kurze Erklärung.

Es ist auch diese Ressource verfügbar sein soll, die Visual Studio Image Library, die benutzt werden kann, um Anwendungen zu erstellen, die visuell konsistent mit den Microsoft software", vermutlich unterliegt die Lizenzierung unten.https://www.microsoft.com/en-ca/download/details.aspx?id=35825

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top