This part will extra your icons from a file
Code:
Declare Function ExtractIconEx Lib "shell32" Alias "ExtractIconExA" (ByVal lpszFile As String, ByVal nIconIndex As Long, phIconLarge As Long, phIconSmall As Long, ByVal nIcons As Long) As Long
Function GetIconsFromFile(Filename$)
Dim hIcons()
ReDim hIcons(ExtractIconEx(Filename, -1, ByVal 0&, ByVal 0&, 0))
If UBound(hIcons) = 0 Then Exit Function Else ReDim Preserve hIcons(UBound(hIcons) - 1)
ExtractIconEx Filename, 0, hIcons(0), ByVal 0&, 10
GetIconsFromFile = hIcons
End Function
In registry you've got the key ie ".bas"
HKEY_CLASSES_ROOT\.bas\
which default property "VisualBasic.Module" point you to:
HKEY_CLASSES_ROOT\VisualBasic.Module\DefaultIcon
which default property is:
D:\program files\vb5\vb5.exe,8
declare an long array and assign it GetIconsFromFile and the 8'th icon is your handle
draw it on a device context with drawicon api
Code:
Declare Function DrawIcon Lib "user32" Alias "DrawIcon" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long