Jak uzyskać ikony z shell32./ align = "left" /

Chciałbym, aby ikona drzewa była używana dla aplikacji domowej. Czy ktoś wie, jak wyodrębnić obrazy jako .pliki ikon? Chciałbym zarówno 16x16 i 32x32, lub po prostu zrobić Screen capture.

Author: Jaqueline Vanek, 2008-08-12

10 answers

W programie Visual Studio wybierz opcję " Otwórz plik.../ align = "left" / ..". Następnie wybierz Shell32.dll. Należy otworzyć drzewo folderów, a ikony znajdziesz w folderze "Icon".

Aby zapisać ikonę, możesz kliknąć prawym przyciskiem myszy ikonę w drzewie folderów i wybrać "Eksportuj".

 40
Author: jm.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-02-06 13:42:13

Jeśli ktoś szuka łatwego sposobu, wystarczy użyć 7zip, aby rozpakować shell32.dll i poszukaj folderu .src / ICON /

 30
Author: AQN,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-06-14 01:41:03

Inną opcją jest użycie narzędzia takiego jak ResourceHacker . Obsługuje znacznie więcej niż tylko ikony. Zdrowie!

 18
Author: OJ.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2008-08-12 04:17:42

Musiałem wyodrębnić ikonę # 238 z shell32.dll i nie chciał pobrać Visual Studio lub Resourcehacker, więc znalazłem kilka skryptów PowerShell od Technet (dzięki John Grenfell i do #https://social.technet.microsoft.com/Forums/windowsserver/en-US/16444c7a-ad61-44a7-8c6f-b8d619381a27/using-icons-in-powershell-scripts?forum=winserverpowershell), który zrobił coś podobnego i stworzył nowy skrypt (poniżej) do moich potrzeb.

Wprowadzone przeze mnie parametry to (the ścieżka źródłowa DLL, nazwa pliku docelowego ikony i indeks ikon w pliku DLL):

C:\Windows\System32\shell32.dll

C:\Temp\Restart.ico

238

Odkryłem, że indeks ikon, którego potrzebowałem, to #238 metodą prób i błędów, tymczasowo tworząc nowy skrót (kliknij prawym przyciskiem myszy na pulpicie i wybierz nowy -- > skrót, wpisz calc i naciśnij Enter dwukrotnie). Następnie kliknij prawym przyciskiem myszy nowy skrót i wybierz Właściwości, a następnie kliknij przycisk "Zmień ikonę"na karcie skrótu. Wklej w ścieżce C:\Windows\System32\shell32.dll i kliknij OK. Znajdź ikonę, której chcesz użyć i opracuj jej indeks. Uwaga: indeks # 2 znajduje się poniżej #1, a nie po jego prawej stronie. Icon index # 5 był na górze kolumny drugiej na moim komputerze z systemem Windows 7 x64.

Jeśli ktoś ma lepszą metodę, która działa podobnie, ale uzyskuje ikony wyższej jakości, to byłbym zainteresowany. Dzięki, 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"
 7
Author: Shaun,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-01-22 14:22:48

Resources Extract to kolejne narzędzie, które rekurencyjnie znajdzie ikony z wielu bibliotek DLL, bardzo poręczne IMO.

 4
Author: Steve Cadwallader,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-04-06 19:51:18

Możesz pobrać freeware Resource Hacker , a następnie postępować zgodnie z poniższymi instrukcjami:

  1. Otwórz dowolny plik dll, z którego chcesz znaleźć ikony.
  2. Przeglądaj foldery, aby znaleźć określone ikony.
  3. z paska menu wybierz "akcja", a następnie "zapisz".
  4. Wybierz miejsce docelowe dla .plik ico.

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

 2
Author: JohnOconor,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-11-12 13:12:38

Oto zaktualizowana wersja rozwiązania powyżej. Dodałem brakujący zespół, który został zakopany w linku. Nowicjusze tego nie zrozumieją. To jest próbka będzie działać bez modyfikacji.

    <#
.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]"
 2
Author: Mr. Annoyed,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-11-20 19:56:16

Wystarczy otworzyć bibliotekę DLL za pomocą IrfanView i zapisać wynik jako .gif lub ..jpg

Wiem, że to pytanie jest stare, ale to drugi hit google z "wyodrębnij ikonę z dll", chciałem uniknąć instalowania czegokolwiek na mojej stacji roboczej i przypomniałem sobie, że używam IrfanView.

 1
Author: MannyO,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-05-22 14:58:20

Jeśli korzystasz z Linuksa, możesz wyodrębnić ikony z biblioteki DLL systemu Windows za pomocą gExtractWinIcons . Jest dostępny w Ubuntu i Debianie w pakiecie gextractwinicons.

Ten artykuł na blogu ma zrzut ekranu i krótkie wyjaśnienie .

 1
Author: Smylers,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2014-07-23 08:43:49

Dostępny jest również ten zasób, biblioteka obrazów Visual Studio, która "może być używana do tworzenia aplikacji, które wyglądają wizualnie spójnie z oprogramowaniem Microsoftu", prawdopodobnie pod warunkiem licencjonowania podanego na dole. https://www.microsoft.com/en-ca/download/details.aspx?id=35825

 1
Author: David Carr,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-03-22 22:05:24