''' <summary>
''' Returns an icon for a given file - indicated by the name parameter
''' </summary>
''' <param name="name">Pathname for file</param>
''' <param name="size">Large or small</param>
''' <param name="linkOverlay">Whether to include the link icon</param>
''' <returns>SystemDrawingIcon</returns>
Public Shared Function GetFileIcon(ByVal name As String, ByVal size As IconSize, ByVal linkOverlay As Boolean) As SystemDrawingIcon
Dim shfi As New Shell32SHFILEINFO()
Dim flags As UInteger = Shell32SHGFI_ICON Or Shell32SHGFI_USEFILEATTRIBUTES
If True = linkOverlay Then
flags += Shell32SHGFI_LINKOVERLAY
End If
' Check the size specified for return
If IconSizeSmall = size Then
flags += Shell32SHGFI_SMALLICON
Else
flags += Shell32SHGFI_LARGEICON
End If
Shell32SHGetFileInfo(name, Shell32FILE_ATTRIBUTE_NORMAL, shfi, CInt(SystemRuntimeInteropServicesMarshalSizeOf(shfi)), flags)
' Copy (clone) the returned icon to a new object, thus allowing us to clean-up properly
Dim icon As SystemDrawingIcon = DirectCast(SystemDrawingIconFromHandle(shfihIcon)Clone(), SystemDrawingIcon)
User32DestroyIcon(shfihIcon)
' Cleanup
Return icon
end function
百分之百可用,只限jdk14用不了,会报错。本人试了,jdk16可以使用
public static void main(String[] args) throws Exception {
File file = new File( "D:\\Program Files\\Tencent\\QQ\\Bin\\QQexe"); \\提取图标的应用程序
OutputStream inStream = new FileOutputStream(new File("c:\\45png")); \\图标保存地址
try {
BufferedImage >
程序大概分成三个部分:
1获取手机已安装的所有应用package的信息(其中包括用户自己安装的,还有系统自带的);
2滤除系统自带应用;
3通过列表显示出应用程序的图标(icon),和其他文字信息(应用名称,包名称package name,版本号等等)
首先,我们定义一个数据结构,来保存应用程序信息(icon,name,packageName,versionName,versionCode,等)
具体的实现 推荐一个网址给你>
以上就是关于vb.net怎样获取应用程序的图标全部的内容,包括:vb.net怎样获取应用程序的图标、java提取应用程序的图标、如何提取android手机所有app的icon图标等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)