Please confirm if the variables used logoPath will contain the complete path of the image and pctLogo is an Image type variable.
logoPath is the complete path to the image.
pctLogo is a control of the type System.Windows.Forms.PictureBox, but the image-property is of the same type for every control. I think the code would also work if pctLogo would be a CommandButton ;)
Partial Public Class Form1
' Constants that we need in the function call
Private Const SHGFI_ICON As Integer = &H100
Private Const SHGFI_SMALLICON As Integer = &H1
Private Const SHGFI_LARGEICON As Integer = &H0
' This structure will contain information about the file
Public Structure SHFILEINFO
' Handle to the icon representing the file
Public hIcon As IntPtr
' Index of the icon within the image list
Public iIcon As Integer
' Various attributes of the file
Public dwAttributes As UInteger
' Path to the file
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
Public szDisplayName As String
' File type
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
Public szTypeName As String
' The signature of SHGetFileInfo (located in Shell32.dll)
Public Shared Function SHGetFileInfo(ByVal pszPath As String, ByVal dwFileAttributes As UInteger, ByRef psfi As SHFILEINFO, ByVal cbFileInfo As Integer, ByVal uFlags As UInteger) As IntPtr
Public Sub New()
Private Sub btnExtract_Click(ByVal sender As Object, ByVal e As EventArgs)
' Will store a handle to the small icon
Dim hImgSmall As IntPtr
' Will store a handle to the large icon
Dim hImgLarge As IntPtr
Dim shinfo As New SHFILEINFO()
' Open the file that we wish to extract the icon from
If openFile.ShowDialog() = DialogResult.OK Then
' Store the file name
Dim FileName As String = openFile.FileName
' Store the icon in this myIcon ...
The contents of the zipfile is placed in the targetfolder. You can use DirectoryInfo.GetFiles() to process each file in the targetdir and extract them afterwards if you want.
Another option would be to use the FastZip(FastZipEvents) to create the new instance so you get notified of each individual file that is being unpacked. When you unpack another zipfile, you can respond to that on the spot.
Sorry I cannot give you any code. I don't have the lib installed.