⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shell32.vb

📁 自己编的zip压缩工具。以供大家参考
💻 VB
字号:

Imports System
Imports System.Runtime.InteropServices

Public Class Shell32

    'This function get the icon for the specified file path extension
    Public Shared Function GetIcon(ByVal filePath As String) As System.Drawing.Icon

        'Get the extension
        Dim ext As String = IO.Path.GetExtension(filePath)

        Dim shellFileInfo As New Shell32.SHFILEINFO()

        Shell32.SHGetFileInfo(ext, 128, shellFileInfo, _
                    Convert.ToUInt32( _
                        Runtime.InteropServices.Marshal.SizeOf(shellFileInfo)), _
                    Convert.ToUInt32(256I Or 1I Or 16I))

        Dim ico As System.Drawing.Icon = System.Drawing.Icon.FromHandle(shellFileInfo.hIcon)

        Return ico

    End Function


    <StructLayout(LayoutKind.Sequential)> _
        Private Structure SHFILEINFO

        Public hIcon As IntPtr
        Public iIcon As Integer
        Public dwAttributes As System.UInt32
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> _
        Public szDisplayName As String
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
        Public szTypeName As String

    End Structure


    <DllImport("Shell32.dll")> _
        Private Shared Function SHGetFileInfo( _
        ByVal pszPath As String, _
        ByVal dwFileAttributes As System.UInt32, _
        ByRef psfi As SHFILEINFO, _
        ByVal cbFileInfo As System.UInt32, _
        ByVal uFlags As System.UInt32) As IntPtr
    End Function

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -