'在Form上添加一个ListBox列表控件
'代码如下:
Option Explicit
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 DrawIcon Lib “user32” (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long
Private Declare Function DestroyIcon Lib “user32” (ByVal hIcon As Long) As Long
Dim Cnt As Long, mIcon As Long
Private Sub Form_Load()
For Cnt = 0 To 328
List1.AddItem Cnt
Next Cnt
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Me.Cls
ExtractIconEx “shell32.dll”, List1.List(List1.ListIndex), mIcon, ByVal 0&, 1
DrawIcon Me.hdc, 50, 100, mIcon
DestroyIcon mIcon
End Sub