我想将Tree图标用于本土应用程序.有谁知道如何以.icon文件的形式提取图像?我想要16x16和32x32,或者我只是做一个屏幕截图.
jm.*_*jm. 45
在Visual Studio中,选择"文件打开...",然后选择"文件...".然后选择Shell32.dll.应打开文件夹树,您将在"Icon"文件夹中找到图标.
要保存图标,可以右键单击文件夹树中的图标,然后选择"导出".
The*_*nOz 28
不确定我是否 100% 正确,但根据我的测试,上述使用 7Zip 或 VS 的选项不适用于 Windows 10 / 11 版本的 imageres.dll 或 shell32.dll。这是我看到的内容:
[shell32.dll]
.rsrc\MANIFEST\124
.rsrc\MUI\1
.rsrc\TYPELIB\1
.rsrc\version.txt
.data
.didat
.pdata
.rdata
.reloc
.text
CERTIFICATE
Run Code Online (Sandbox Code Playgroud)
更新:我想我找到了原因。链接到我找到的一篇文章。(抱歉不在域内)。您可以在以下位置的文件中找到资源:
"C:\Windows\SystemResources\shell32.dll.mun"
"C:\Windows\SystemResources\imageres.dll.mun"
Run Code Online (Sandbox Code Playgroud)
Windows 10 1903 中的 imageres.dll 中不再有图标 - 4kb 文件 (superuser.com)
我需要从shell32.dll中提取图标#238并且不想下载Visual Studio或Resourcehacker,所以我从Technet找到了几个PowerShell脚本(感谢John Grenfell和#https://social.technet.microsoft . com /论坛/ windowsserver/en-US/16444c7a-ad61-44a7-8c6f-b8d619381a27/using-icons-in-powershell-scripts?forum = winserverpowershell)做了类似的事情并创建了一个新的脚本(下面)以满足我的需要.
我输入的参数是(源DLL路径,目标图标文件名和DLL文件中的图标索引):
C:\ WINDOWS\SYSTEM32\SHELL32.DLL
C:\ TEMP\Restart.ico
238
我通过临时创建一个新的快捷方式(右键单击桌面并选择New - > Shortcut并输入calc并按两次Enter键)通过反复试验发现我需要的图标索引为#238.然后右键单击新快捷方式并选择"属性",然后单击"快捷方式"选项卡中的"更改图标"按钮.粘贴在路径C:\ Windows\System32\shell32.dll中,然后单击"确定".找到您要使用的图标并计算出其索引.注意:索引#2位于#1之下,而不是右侧.在我的Windows 7 x64机器上,图标索引#5位于第二列的顶部.
如果有人有一个更好的方法,工作方式相似,但获得更高质量的图标,那么我有兴趣听到它.谢谢,肖恩.
#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"
Run Code Online (Sandbox Code Playgroud)
小智 7
只需使用 IrfanView 打开 DLL 并将结果保存为 .gif 或 .jpg。
我知道这个问题很旧,但这是“从 dll 中提取图标”的第二次谷歌点击,我想避免在我的工作站上安装任何东西,我记得我使用 IrfanView。
Resources Extract是另一个工具,可以从很多DLL(非常方便的IMO)中递归地找到图标。
归档时间: |
|
查看次数: |
64619 次 |
最近记录: |