diff --git a/Pilz.Win32/Internals/IconExtractor.vb b/Pilz.Win32/Internals/IconExtractor.vb index 1411abe..2f37e5b 100644 --- a/Pilz.Win32/Internals/IconExtractor.vb +++ b/Pilz.Win32/Internals/IconExtractor.vb @@ -18,7 +18,7 @@ Namespace Internals Dim shinfo As New SHFILEINFO Dim small As Boolean = size = SystemIconSize.Small - LibShell32.SHGetFileInfo(FilePath, 0, shinfo, Math.Truncate(Marshal.SizeOf(shinfo)), SHFILEINFO.SHGFI_ICON Or If(Small, SHFILEINFO.SHGFI_SMALLICON, SHFILEINFO.SHGFI_LARGEICON)) + Shell32.SHGetFileInfo(FilePath, 0, shinfo, Math.Truncate(Marshal.SizeOf(shinfo)), SHFILEINFO.SHGFI_ICON Or If(small, SHFILEINFO.SHGFI_SMALLICON, SHFILEINFO.SHGFI_LARGEICON)) Try icon = Icon.FromHandle(shinfo.hIcon) diff --git a/Pilz.Win32/Mapped/FileTypeIcons.vb b/Pilz.Win32/Mapped/FileTypeIcons.vb index feb0cf5..395cd49 100644 --- a/Pilz.Win32/Mapped/FileTypeIcons.vb +++ b/Pilz.Win32/Mapped/FileTypeIcons.vb @@ -8,7 +8,7 @@ Namespace Mapped Return Internals.IconExtractor.ExtractIcon(filePath, size) End Function - Public Function ExtractIconFromFileExtension(fileExtension As String, size As SystemIconSize) + Public Function ExtractIconFromFileExtension(fileExtension As String, size As SystemIconSize) As Icon Return Internals.IconFactory.IconFromExtensionShell(fileExtension, size) End Function diff --git a/Pilz.Win32/Native/LibShell32.vb b/Pilz.Win32/Native/LibShell32.vb deleted file mode 100644 index 7ce4246..0000000 --- a/Pilz.Win32/Native/LibShell32.vb +++ /dev/null @@ -1,9 +0,0 @@ -Namespace Native - - Public Class LibShell32 - - Public Declare Function SHGetFileInfo Lib "shell32.dll" (ByVal pszPath As String, ByVal dwFileAttributes As UInteger, ByRef psfi As SHFILEINFO, ByVal cbSizeFileInfo As UInteger, ByVal uFlags As UInteger) As IntPtr - - End Class - -End Namespace diff --git a/Pilz.Win32/Native/Shell32.vb b/Pilz.Win32/Native/Shell32.vb index f6595e1..b0ed266 100644 --- a/Pilz.Win32/Native/Shell32.vb +++ b/Pilz.Win32/Native/Shell32.vb @@ -61,9 +61,7 @@ Namespace Native Public Shared Function ExtractIconEx( ByVal lpszFile As String, ByVal nIconIndex As Integer, ByVal phIconLarge As IntPtr(), ByVal phIconSmall As IntPtr(), ByVal nIcons As Integer) As Integer End Function - - Public Shared Function SHGetFileInfo(ByVal pszPath As String, ByVal dwFileAttributes As Integer, ByRef psfi As SHFILEINFO, ByVal cbFileInfo As Integer, ByVal uFlags As FileInfoFlags) As IntPtr - End Function + Public Declare Function SHGetFileInfo Lib "shell32.dll" (ByVal pszPath As String, ByVal dwFileAttributes As UInteger, ByRef psfi As SHFILEINFO, ByVal cbSizeFileInfo As UInteger, ByVal uFlags As UInteger) As IntPtr End Class