Hey, it worked. I've put it into a function to make it more organized.
VB Code:
Private Declare Function ExtractIconEx Lib "shell32.dll" Alias "ExtractIconExA" (ByVal lpszFile As String, ByVal nIconIndex As Long, phiconLarge As Long, phiconSmall As Long, ByVal nIcons As Long) As Long Private Declare Function DestroyIcon Lib "user32" (ByVal hIcon As Long) As Long 'sFile = The filename you want to search Private Function GetIconCount(ByVal sFile As String) As Integer Dim hIcon As Long Dim iCount As Integer Do ExtractIconEx sFile, iCount, hIcon, ByVal 0&, 1 If hIcon = 0 Then Exit Do Else DestroyIcon hIcon iCount = iCount + 1 End If Loop GetIconCount = iCount End Function Private Sub Command1_Click() 'Call the function icons = GetIconCount("Shell32.dll") MsgBox "There are: " & icons & " icons in this file" End Sub




Reply With Quote