'************** Code Start *************
'
'------------------------------
' Do NOT try to step through
' this code. Entering debug mode
' will cause a GPF if the window
' is subclassed.
'------------------------------
'//LoadImage flags
Private Const WM_GETICON = &H7F 'message is sent to a window to retrieve a handle _
to the large or small icon associated with a window
Private Const WM_SETICON = &H80 'message to associate a new large or small icon with a window
Private Const IMAGE_BITMAP = 0 'Loads a bitmap.
Private Const IMAGE_ICON = 1 ' Loads an icon.
Private Const IMAGE_CURSOR = 2 'Loads a cursor.
Private Const LR_LOADFROMFILE = &H10 'Loads the image from the file specified by _
the lpszName parameter. If this flag is not _
specified, lpszName is the name of the resource.
Private Const ICON_SMALL = 0& 'Retrieve the small icon for the window.
Private Const ICON_BIG = 1& 'Retrieve the large icon for the window.
'loads an icon, cursor, or bitmap.
Private Declare Function apiLoadImage Lib "user32" _
Alias "LoadImageA" _
(ByVal hInst As Long, _
ByVal lpszName As String, _
ByVal uType As Long, _
ByVal cxDesired As Long, _
ByVal cyDesired As Long, _
ByVal fuLoad As Long) _
As Long
Private Declare Function apiSendMessageLong Lib "user32" _
Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) _
As Long
'//SHGetFileInfo flags
Private Const SHGFI_ICON = &H100 '// get icon
Private Const SHGFI_DISPLAYNAME = &H200 '// get display name
Private Const SHGFI_TYPENAME = &H400 '// get type name
Private Const SHGFI_ATTRIBUTES = &H800 '// get attributes
Private Const SHGFI_ICONLOCATION = &H1000 '// get icon location
Private Const SHGFI_EXETYPE = &H2000 '// return exe type
Private Const SHGFI_SYSICONINDEX = &H4000 '// get system icon index
Private Const SHGFI_LINKOVERLAY = &H8000 '// put a link overlay on icon
Private Const SHGFI_SELECTED = &H10000 '// show icon in selected state
Private Const SHGFI_ATTR_SPECIFIED = &H20000 '// get only specified attributes
Private Const SHGFI_LARGEICON = &H0 '// get large icon
Private Const SHGFI_SMALLICON = &H1 '// get small icon
Private Const SHGFI_OPENICON = &H2 '// get open icon
Private Const SHGFI_SHELLICONSIZE = &H4 '// get shell size icon
Private Const SHGFI_PIDL = &H8 '// pszPath is a pidl
Private Const SHGFI_USEFILEATTRIBUTES = &H10 '// use passed dwFileAttribute
Private Type SHFILEINFO
hIcon As Long 'Handle to the icon that represents the file.
iIcon As Long 'Index of the icon image within the _
system image list.
dwAttributes As Long 'Array of values that indicates the _
attributes of the file object.
szDisplayName As String * MAX_PATH 'String that contains the name of the _
file as it appears in the Windows shell
szTypeName As String * 80 'String that describes the type of file.
End Type
'Retrieves information about an object in the file system,
'such as a file, a folder, a directory, or a drive root.
Private Declare Function apiSHGetFileInfo Lib "shell32.dll" _
Alias "SHGetFileInfo