diff --git a/Pilz.Win32/Internals/IconExtractor.vb b/Pilz.Win32/Internals/IconExtractor.vb
index b3011f5..d6487b9 100644
--- a/Pilz.Win32/Internals/IconExtractor.vb
+++ b/Pilz.Win32/Internals/IconExtractor.vb
@@ -11,18 +11,11 @@ Namespace Internals
'''
''' Hier übergeben Sie den Pfad der Datei von dem das Icon extrahiert werden soll.
''' Bei übergabe von true wird ein kleines und bei false ein großes Icon zurück gegeben.
- Public Shared Function ExtractIcon(ByVal FilePath As String, ByVal Small As Boolean) As Icon
- Dim hImgSmall As IntPtr
- Dim hImgLarge As IntPtr
+ Public Shared Function ExtractIcon(FilePath As String, Small As Boolean) As Icon
+ Dim icon As Icon
Dim shinfo As New SHFILEINFO
- If Small Then
- hImgSmall = LibShell32.SHGetFileInfo(FilePath, 0, shinfo, CUInt(Math.Truncate(Marshal.SizeOf(shinfo))), SHFILEINFO.SHGFI_ICON Or SHFILEINFO.SHGFI_SMALLICON)
- Else
- hImgLarge = LibShell32.SHGetFileInfo(FilePath, 0, shinfo, CUInt(Math.Truncate(Marshal.SizeOf(shinfo))), SHFILEINFO.SHGFI_ICON Or SHFILEINFO.SHGFI_LARGEICON)
- End If
-
- Dim icon As Icon
+ LibShell32.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/Native/LibShell32.vb b/Pilz.Win32/Native/LibShell32.vb
index 980ba19..7ce4246 100644
--- a/Pilz.Win32/Native/LibShell32.vb
+++ b/Pilz.Win32/Native/LibShell32.vb
@@ -2,7 +2,7 @@
Public Class LibShell32
- Public Declare Auto 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
+ 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
diff --git a/Pilz.Win32/Native/SHFILEINFO.vb b/Pilz.Win32/Native/SHFILEINFO.vb
index 8c4acc7..2cd55f8 100644
--- a/Pilz.Win32/Native/SHFILEINFO.vb
+++ b/Pilz.Win32/Native/SHFILEINFO.vb
@@ -2,9 +2,9 @@
Namespace Native
+
Public Structure SHFILEINFO
-
Public Const SHGFI_ICON As UInteger = &H100
Public Const SHGFI_LARGEICON As UInteger = &H0
Public Const SHGFI_SMALLICON As UInteger = &H1
@@ -16,7 +16,6 @@ Namespace Native
Public szDisplayName As String
Public szTypeName As String
-
End Structure
End Namespace