Introduction
The CUseShGetFileInfo
class is built around the use of
ShGetFileInfo()
function. It's a very simple class, but I think it can be
usefull. You will not have to worry anymore about setting flags and it also
works for names of files that do not exist. You don't need to know
the full path for a certain file in order to obtain its icon, file type or its
icon's index in the system's image list (both large icons and small icons).
It also provides a function for obtaining a handle to the system's image
list.
User functions
Use the GetFileIconIndex
function to obtain the index of the file's
associated icon in the system's image list.
int CUseShGetFileInfo::GetFileIconIndex( CString strFileName , BOOL bSmallIcon )
Use the GetDirIconIndex
function to obtain the index of the folder's
associated icon in the system's image list.
int CUseShGetFileInfo::GetDirIconIndex( BOOL bSmallIcon )
Use the GetFileIconHandle
function to obtain a handle to the
file's associated icon in the system's image list.
HICON CUseShGetFileInfo::GetFileIconHandle( CString strFileName, BOOL bSmallIcon )
Use the GetFolderIconHandle
function to obtain a handle to the
folder's associated icon in the system's image list.
HICON CUseShGetFileInfo::GetFolderIconHandle( BOOL bSmallIcon )
Use the GetFileType
function to obtain a file's type (e.g. Winamp
media file).
CString CUseShGetFileInfo::GetFileType( CString strFileName)
Use the GetSystemImageListHandle function to obtain a handle to the system's
image list (large icons or small icons). Use this function to create a
CImageList
object to attach to a list control. After this image list is attached
to the list control, use GetFileIconIndex
or GetDirIconIndex
to obtain the
value to set for the nImage field (e.g. CListCtrl::InsertItem()
function)
HIMAGELIST CUseShGetFileInfo::GetSystemImageListHandle( BOOL bSmallIcon )