Vra

Ek wil graag te kry om die Boom ikoon om te gebruik vir'n inheemse app.Is daar iemand wat weet hoe om te onttrek van die beelde uit die as .ikoon-lêers?Ek wil graag beide die 16x16 en 32x32, of ek wil net nie'n screen capture.

Was dit nuttig?

Oplossing

In Visual Studio, kies "Lêer Open ..." dan "Lêer ...". kies dan die Shell32.dll. A gids boom moet oopgemaak word, en jy sal die ikone te vind in die gids "simbool".

Om 'n ikoon te red, kan jy regs-kliek op die ikoon in die gids boom en kies "Uitvoer".

Ander wenke

As iemand is op soek na 'n maklike manier, net gebruik 7zip om die shell32.dll Pak en kyk vir die gids .src / ICON /

Nog 'n opsie is om 'n instrument te gebruik soos ResourceHacker . Dit hanteer manier om meer as net ikone sowel. Cheers!

Ek moes onttrek ikoon # 238 van shell32.dll en wou nie Visual Studio of Resourcehacker aflaai, so ek het 'n paar van PowerShell skrifte uit Technet (dankie John Grenfell en # https://social.technet .microsoft.com / Forum / windowsserver / nl-nL / 16444c7a-ad61-44a7-8c6f-b8d619381a27 / behulp-ikone-in-Powershell-skrifte? forum = winserverpowershell ) dat iets soortgelyks gedoen en het 'n nuwe script (onder) aan my behoeftes te pas.

Die parameters ek aangegaan het (die bron DLL pad, teiken ikoon lêer naam en die ikoon indeks binne die DLL-lêer):

C: \ Windows \ System32 \ shell32.dll

C: \ Temp \ Restart.ico

238

Ek ontdek die ikoon indeks wat ek nodig het, is # 238 deur trial and error deur tydelik die skep van 'n nuwe kortpad (regs-kliek op jou lessenaar en kies Nuwe -> Kortpad en tik in calc en druk Enter twee keer). Dan regs-kliek die nuwe kortpad en kies Properties kliek dan op 'Change Icon "knoppie in die blad Kortpad. Plak in pad C: \ Windows \ System32 \ shell32.dll en klik op OK. Vind die ikoon wat jy wil gebruik en uit te werk sy indeks. NB: Index # 2 is onder # 1 en nie om sy reg. Ikoon indeks # 5 was aan die bokant van die kolom twee op my Windows 7 x64 masjien.

As iemand 'n beter metode wat insgelyks werk, maar wat 'n hoër gehalte ikone dan sou ek belangstel om te hoor oor dit. Dankie, 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"

Resources Uittreksel is 'n ander instrument wat rekursief ikone sal vind vanaf 'n baie DLLs, baie handig IMO.

Hier is'n opgedateerde weergawe van'n oplossing hierbo.Ek het bygevoeg'n vermiste vergadering wat begrawe is in'n skakel.Beginners sal nie verstaan nie.Hierdie is die monster sal loop sonder veranderinge.

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

Net oop die DLL met Irfan View en die resultaat stoor as 'n gif of .jpg.

Ek weet hierdie vraag is oud, maar dit is die tweede Google tref van "uittreksel ikoon uit dll" Ek wou vermy enigiets te installeer op my werkstasie en ek onthou ek gebruik Irfan View.

Jy kan dit aflaai freeware Resource Hacker en dan volg instruksies hieronder:

  1. Maak enige dll-lêer wat jy wil ikone te vind uit.
  2. Blaai deur dopgehou om spesifieke ikone te vind.
  3. Van menubalk, kies 'aksie' en dan 'red'.
  4. Kies bestemming vir Ico lêer.

Reference: http://techsultan.com/how-to -extract-ikone-uit-windows-7 /

As jy op Linux, kan jy ikone uit 'n Windows DLL met gExtractWinIcons onttrek. Dit is beskikbaar in Ubuntu en Debian in die gextractwinicons pakket.

Hierdie blog artikel het 'n kiekie en kort verduideliking .

Daar is ook hierdie hulpbron beskikbaar, die Visual Studio Image Library, wat "kan gebruik word om programme wat visueel in ooreenstemming met Microsoft sagteware kyk skep", vermoedelik om die lisensiëring gegee aan die onderkant onderwerp. https://www.microsoft.com/en-ca/ aflaai / details.aspx? id = 35.825

Gelisensieer onder: CC-BY-SA met toeskrywing
Nie verbonde aan StackOverflow
scroll top