VB 提取exe 中的图标(ICO)
我想用VB提取exe的图标(ICO)怎么搞,不要太失真,我这里有一个失真的例子,感觉不太好,做的好的另追加200分1,2,3楼回答的都不是我想要的,我是自己做出来。当然,...
我想用VB提取exe的图标(ICO)怎么搞,不要太失真,我这里有一个失真的例子,感觉不太好,做的好的另追加200分
1,2,3楼回答的都不是我想要的,我是自己做出来。当然,别人的,网上多的是,我也有。我只是对我的一个软件增加一个功能,能实现提取exe ICO的话,用VB,另加200。理论的人,就不要回答了 展开
1,2,3楼回答的都不是我想要的,我是自己做出来。当然,别人的,网上多的是,我也有。我只是对我的一个软件增加一个功能,能实现提取exe ICO的话,用VB,另加200。理论的人,就不要回答了 展开
展开全部
'SavePicture方法保存ico图标时会失真,他保存真彩色时候会自动把图标转换成256色,这也是这个方法保存ico的不足,除非自己懂ico文件结构,把ico图标数据自己写到文件中,否则该函数会自动将真彩色
转换
256色保存,放在picturebox中的图片已经不是ico图标了,那是bmp图片,即使把bmp背景去掉还是要显示出来,ico图片里面有2张位图,一张是真图,另一张是掩码图(掩码图就是在显示的时候去除真图中不该显示的地方,比如说把ico图标放在桌面显示,系统会将ico的真图和掩码图拿出来,通过掩码图进行一种图像的叠加计算,让真图不该显示的地方去掉,让这个去掉的地方显示桌面的背景图)
Private
Type
PicBmp
Size
As
Long
tType
As
Long
hBmp
As
Long
hPal
As
Long
Reserved
As
Long
End
Type
Private
Type
GUID
Data1
As
Long
Data2
As
Integer
Data3
As
Integer
Data4(7)
As
Byte
End
Type
Private
Declare
Function
ExtractIcon&
Lib
"shell32.dll"
Alias
"ExtractIconA"
(ByVal
hInst
As
Long,
ByVal
lpszExeFileName
As
String,
ByVal
nIconIndex
As
Long)
Private
Declare
Function
OleCreatePictureIndirect
Lib
"olepro32.dll"
(PicDesc
As
PicBmp,
RefIID
As
GUID,
ByVal
fPictureOwnsHandle
As
Long,
IPic
As
Picture)
As
Long
Private
Declare
Function
ExtractIconEx
Lib
"shell32.dll"
Alias
"ExtractIconExA"
(ByVal
lpszFile
As
String,
ByVal
nIconIndex
As
Long,
phiconLarge
As
Long,
phiconSmall
As
Long,
ByVal
nIcons
As
Long)
As
Long
Private
Declare
Function
DestroyIcon
Lib
"user32"
(ByVal
hIcon
As
Long)
As
Long
Public
Function
GetIconFromFile(FileName
As
String)
As
Picture
Dim
hlargeicon
As
Long,
hsmallicon
As
Long,
selhandle
As
Long
Dim
pic
As
PicBmp,
IPic
As
IPicture,
IID_IDispatch
As
GUID
selhandle
=
ExtractIcon(0,
FileName,
0)
If
selhandle
>
0
Then
With
IID_IDispatch
.Data1
=
&H20400
.Data4(0)
=
&HC0
.Data4(7)
=
&H46
End
With
With
pic
.Size
=
Len(pic)
.tType
=
vbPicTypeIcon
.hBmp
=
selhandle
End
With
Call
OleCreatePictureIndirect(pic,
IID_IDispatch,
0,
IPic)
Picture1.Picture
=
IPic
Set
GetIconFromFile
=
IPic
DestroyIcon
hsmallicon
DestroyIcon
hlargeicon
End
If
End
Function
Private
Sub
Form_Load()
SavePicture
GetIconFromFile("exe文件路径"),
"保存的位置.ico"
End
Sub
转换
256色保存,放在picturebox中的图片已经不是ico图标了,那是bmp图片,即使把bmp背景去掉还是要显示出来,ico图片里面有2张位图,一张是真图,另一张是掩码图(掩码图就是在显示的时候去除真图中不该显示的地方,比如说把ico图标放在桌面显示,系统会将ico的真图和掩码图拿出来,通过掩码图进行一种图像的叠加计算,让真图不该显示的地方去掉,让这个去掉的地方显示桌面的背景图)
Private
Type
PicBmp
Size
As
Long
tType
As
Long
hBmp
As
Long
hPal
As
Long
Reserved
As
Long
End
Type
Private
Type
GUID
Data1
As
Long
Data2
As
Integer
Data3
As
Integer
Data4(7)
As
Byte
End
Type
Private
Declare
Function
ExtractIcon&
Lib
"shell32.dll"
Alias
"ExtractIconA"
(ByVal
hInst
As
Long,
ByVal
lpszExeFileName
As
String,
ByVal
nIconIndex
As
Long)
Private
Declare
Function
OleCreatePictureIndirect
Lib
"olepro32.dll"
(PicDesc
As
PicBmp,
RefIID
As
GUID,
ByVal
fPictureOwnsHandle
As
Long,
IPic
As
Picture)
As
Long
Private
Declare
Function
ExtractIconEx
Lib
"shell32.dll"
Alias
"ExtractIconExA"
(ByVal
lpszFile
As
String,
ByVal
nIconIndex
As
Long,
phiconLarge
As
Long,
phiconSmall
As
Long,
ByVal
nIcons
As
Long)
As
Long
Private
Declare
Function
DestroyIcon
Lib
"user32"
(ByVal
hIcon
As
Long)
As
Long
Public
Function
GetIconFromFile(FileName
As
String)
As
Picture
Dim
hlargeicon
As
Long,
hsmallicon
As
Long,
selhandle
As
Long
Dim
pic
As
PicBmp,
IPic
As
IPicture,
IID_IDispatch
As
GUID
selhandle
=
ExtractIcon(0,
FileName,
0)
If
selhandle
>
0
Then
With
IID_IDispatch
.Data1
=
&H20400
.Data4(0)
=
&HC0
.Data4(7)
=
&H46
End
With
With
pic
.Size
=
Len(pic)
.tType
=
vbPicTypeIcon
.hBmp
=
selhandle
End
With
Call
OleCreatePictureIndirect(pic,
IID_IDispatch,
0,
IPic)
Picture1.Picture
=
IPic
Set
GetIconFromFile
=
IPic
DestroyIcon
hsmallicon
DestroyIcon
hlargeicon
End
If
End
Function
Private
Sub
Form_Load()
SavePicture
GetIconFromFile("exe文件路径"),
"保存的位置.ico"
End
Sub
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
有一个软件,可以把任何软件里的ICO提取出来,不管是exe还识别的文件,都可以,你要不?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
IcoSprite这个工具提处图标很强,什么样的加密加壳都可以提出来
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
eXeScope 用这个打开EXE 点资源--图标~然后d导出~原滋原味
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询