Print this
window
// Place in the constructor, FormCreate, FormShow, or some other method that you want to
SHFILEINFO info;
DWORD ImageHandle = SHGetFileInfo("", // filename, not needed
0, // file attributes flag, not needed because the last arg does not contain SHGFI_USEFILEATTRIBUTES
&info, // This argument is always the address of a SHFILEINFO structure
sizeof(info), // This arg is always the size of the SHFILEINFO structure
SHGFI_SMALLICON |
SHGFI_SYSICONINDEX);
if (ImageHandle != 0)
{
ilFileImage->Handle = ImageHandle;
ilFileImage->ShareImages = true;
} // End the if
// This is where you will load the list of files in
SHFILEINFO info;
DWORD result;
result = SHGetFileInfo(fl.pFilePath, 0, &info, sizeof(info), SHGFI_SMALLICON |
SHGFI_SYSICONINDEX | SHGFI_TYPENAME);
if (result)
fl.iIconIndex = info.iIcon;
else
fl.iIconIndex = -1;
// In the method where you will display the list of files to the ListView
if (doSearch->getShowIcons())
lvFileList->SmallImages = ilFileImage;
while ((!frmShowStatus->bDidCancelSearch) && (i < MAX))
{
li = lvFileList->Items->Add();
li->ImageIndex = doSearch->getIconIndex(i); // This function just returns the fl.iIconIndex that was called above
if (doSearch->getShowFullPath())
li->Caption = doSearch->getFileNames(i);
else
{
AnsiString t = ExtractFileName(doSearch->getFileNames(i));
if (t != "")
li->Caption = (AnsiString("-->") + ExtractFileName(doSearch->getFileNames(i)));
else
li->Caption = doSearch->getFileNames(i);
} // End the else
li->SubItems->Add(doSearch->getFileDescription(i));
li->SubItems->Add(doSearch->getFileCreated(i));
li->SubItems->Add(doSearch->getFileLastAccess(i));
li->SubItems->Add(doSearch->getFileWrittenLast(i));
li->SubItems->Add(doSearch->getFileAttributes(i));
li->SubItems->Add(doSearch->getFileSizeKB(i));
li->SubItems->Add(doSearch->getFileSizeByte(i));
Application->ProcessMessages();
li->Update();
i++;
} // End the for