获取Shell使用的文件图标

获取Shell使用的文件图标,第1张

获取Shell使用的文件图标
imports System.DrawingModule Module1    Sub Main() Dim filePath As String =  "C:myfile.exe"          Dim TheIcon As Icon = IconFromFilePath(filePath)        If TheIcon IsNot Nothing Then     ''#Save it to disk, or do whatever you want with it. Using stream As New System.IO.FileStream("c:myfile.ico", IO.FileMode.CreateNew)     TheIcon.Save(stream)End Using        End If    End Sub    Public Function IconFromFilePath(filePath As String) As Icon        Dim result As Icon = Nothing        Try result = Icon.ExtractAssociatedIcon(filePath)        Catch ''# swallow and return nothing. You could supply a default Icon here as well        End Try        Return result    End FunctionEnd Module


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5441057.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-11
下一篇 2022-12-11

发表评论

登录后才能评论

评论列表(0条)

保存