by DoctorMO (3 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 2nd August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
If you use the Shell Icons you will need this...
API Declarations
Public Const SMALL_ICON As Integer = 16
Public Const DI_NORMAL = 3
Public Declare Function DrawIconEx Lib "user32" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
Public 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
Dim LargeIcon As Long, SmallIcon As Long
Dim iLargeIcon As Long, iSmallIcon As Long
Dim FileIcon As String
a = ExtractIconEx(FileExe, Index, LargeIcon, SmallIcon, 1)
GoTo AfterThisLot
' Draw the icon to respective picturebox control.
AfterThisLot:
With PicIn
Set .Picture = LoadPicture("")
.AutoRedraw = True
If bLargeIcon = True Then
Call DrawIconEx(.hdc, 0, 0, LargeIcon, Iconsize, Iconsize, 0, 0, DI_NORMAL)
Else
Call DrawIconEx(.hdc, 0, 0, SmallIcon, Iconsize, Iconsize, 0, 0, DI_NORMAL)
End If
.Refresh
End With
ExtractIcon = a
End Function