用API就可以了!Declare Function SHGetFileInfo Lib "shell32" Alias "SHGetFileInfoA" _ (ByVal pszPath As Any, _ ByVal dwFileAttributes As Long, _ psfi As SHFILEINFO, _ ByVal cbFileInfo As Long, _ ByVal uFlags As Long) As Long Public Function GetSystemImagelist(uSize As Long) As Long Dim sfi As SHFILEINFO ' Any valid file system path can be used to retrieve system image list handles. GetSystemImagelist = SHGetFileInfo("C:\", 0, sfi, Len(sfi), SHGFI_SYSICONINDEX Or uSize) End Function
什么意思?
(ByVal pszPath As Any, _
ByVal dwFileAttributes As Long, _
psfi As SHFILEINFO, _
ByVal cbFileInfo As Long, _
ByVal uFlags As Long) As Long
Public Function GetSystemImagelist(uSize As Long) As Long
Dim sfi As SHFILEINFO
' Any valid file system path can be used to retrieve system image list handles.
GetSystemImagelist = SHGetFileInfo("C:\", 0, sfi, Len(sfi), SHGFI_SYSICONINDEX Or uSize)
End Function
Call ListView_SetImageList(m_hwndLV, GetSystemImagelist(SHGFI_SMALLICON), LVSIL_SMALL)
Call ListView_SetImageList(m_hwndLV, GetSystemImagelist(SHGFI_LARGEICON), LVSIL_NORMAL)
http://www.vbfrance.com/codes/EXPLORATEUR-WINDOWS_7433.aspx
不知道各位有什么好的意见或者想法,请发到.cn 敬请探讨!---答:对于Exe文件或没有共同的图标,你必须一个一个读,一个一个添加到Imagelist;但对于那些具有共同的图标的文件,例如jpg文件,你就不必,因为大家都Share同一个图标,添加一次就可以了,大家都指向同一Index.