Question

Je voudrais avoir l'icône en forme d'Arbre à utiliser pour un domaine d'application.Personne ne sait comment extraire les images comme .les fichiers d'icône?J'aimerais tant le 16x16 et 32x32, ou je venais de faire une capture d'écran.

Était-ce utile?

La solution

Dans Visual Studio, choisissez "Fichier Ouvrir..." puis "Fichier...".Ensuite choisissez l'Shell32.dll.Un dossier de l'arborescence doit être ouvert, et vous trouverez les icônes de la "Icône" dossier.

Pour enregistrer une Icône, vous pouvez droit-cliquez sur l'icône dans le dossier de l'arborescence et sélectionnez "Exporter".

Autres conseils

Si quelqu'un est à la recherche d'un moyen facile, il suffit d'utiliser 7zip pour décompresser shell32.dll et recherchez le dossier .src/ICÔNE/

Une autre option est d'utiliser un outil tel que ResourceHacker.Il traite plus que des icônes.Cheers!

J'ai besoin d'extraire l'icône #238 à partir de shell32.dll et je ne veux pas de télécharger Visual Studio ou Resourcehacker, donc j'ai trouvé un couple de scripts PowerShell de microsoft Technet (merci John Grenfell et #https://social.technet.microsoft.com/Forums/windowsserver/en-US/16444c7a-ad61-44a7-8c6f-b8d619381a27/using-icons-in-powershell-scripts?forum=winserverpowershell) qui a fait quelque chose de similaire et a créé un nouveau script (ci-dessous) en fonction de mes besoins.

Les paramètres j'ai saisi (la source de la DLL chemin, icône cible nom de fichier et l'icône de l'index dans le fichier DLL):

C:\Windows\System32\shell32.dll

C: emp estart.ico

238

J'ai découvert l'icône de l'index que j'avais besoin d' #238 par essai et erreur temporairement par la création d'un nouveau raccourci (clic droit sur votre bureau et sélectionnez Nouveau - > Raccourci et le type dans calc et appuyez sur Entrée deux fois).Ensuite, cliquez-droit sur le raccourci et sélectionnez Propriétés, puis cliquez sur "Changer d'Icône" bouton dans l'onglet Raccourci.Coller dans le chemin d'accès C:\Windows\System32\shell32.dll et cliquez sur OK.Trouver l'icône que vous souhaitez utiliser et travailler sur son index.NB:Indice #2 est en-dessous du n ° 1 et non à sa droite.Icône de l'indice n ° 5 a été au sommet de la colonne deux sur mon Windows 7 x64-linge.

Si quelqu'un a une meilleure méthode qui fonctionne de la même façon, mais obtient plus de la qualité des icônes puis je serais intéressé à entendre parler d'elle.Merci, 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"

Les Ressources De L'Extrait De est un autre outil qui va de manière récursive trouver des icônes à partir d'un lot de Dll, très pratique de l'OMI.

Voici une version mise à jour de la solution ci-dessus.J'ai ajouté un manque de l'assemblée qui a été enterré dans un lien.Les Novices ne peuvent pas comprendre que.C'est l'échantillon d'exécuter sans modification.

    <#
.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]"

Il suffit d'ouvrir le fichier DLL avec IrfanView et d'enregistrer le résultat en tant que .gif ou .jpg.

Je sais que cette question est ancienne, mais c'est la deuxième google a frappé de "l'extrait de l'icône à partir de la dll", je voulais éviter d'installer quoi que ce soit sur mon poste de travail et je me suis souvenu que j'utilise IrfanView.

Vous pouvez télécharger freeware Resource Hacker puis suivez les instructions ci-dessous :

  1. Ouvrez n'importe quel fichier dll que vous souhaitez trouver des icônes de.
  2. Parcourir les dossiers pour trouver des icônes spécifiques.
  3. Dans la barre de menus, sélectionnez '"action" puis "enregistrer".
  4. Sélectionnez la destination pour .fichier ico.

Référence : http://techsultan.com/how-to-extract-icons-from-windows-7/

Si vous êtes sous Linux, vous pouvez extraire des icônes à partir d'une DLL de Windows avec gExtractWinIcons.Il est disponible dans Ubuntu et Debian dans le gextractwinicons package.

Cet article de blog a un capture d'écran et une brève explication.

Il y a aussi cette ressource disponible, Visual Studio Image de la Bibliothèque, qui "peut être utilisé pour créer des applications qui ressemblent visuellement compatibles avec les logiciels Microsoft", sans doute soumis à l'agrément donné en bas.https://www.microsoft.com/en-ca/download/details.aspx?id=35825

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top