hanging the view style of your window
}
void CDriveExplorerView::DeleteAllItems()
{
GetListCtrl().DeleteAllItems();
}
void CDriveExplorerView::AddToListView(WIN32_FIND_DATA *fd)
{
LV_ITEM lvitem;
char sNumBuff[100];
int iActualItem;
CString sText;
lvitem.mask = LVIF_TEXT | LVIF_IMAGE;
lvitem.iItem = 0;
lvitem.iSubItem = 0;
lvitem.pszText = GetNTS(fd->cFileName); // fd.cFileName;
lvitem.iImage = GetListViewIcon(fd->cFileName); //SetFileIcon(fd->GetFileName());
iActualItem = GetListCtrl().InsertItem(&lvitem);
// Add Attribute column
lvitem.mask = LVIF_TEXT;
lvitem.iItem = iActualItem;
lvitem.iSubItem = 1;
lvitem.pszText = GetNTS(GetFileType(fd->cFileName));
GetListCtrl().SetItem(&lvitem);
// Add Size column
if(fd->nFileSizeLow != 0)
ltoa((long)fd->nFileSizeLow,sNumBuff,10);
else
strcpy(sNumBuff,"");
lvitem.mask = LVIF_TEXT;
lvitem.iItem = iActualItem;
lvitem.iSubItem = 2;
lvitem.pszText = sNumBuff;
GetListCtrl().SetItem(&lvitem);
// Add Time column
CTime refTime;
refTime = fd->ftCreationTime;
sText = refTime.Format( "%b-%d-%Y" );
lvitem.mask = LVIF_TEXT;
lvitem.iItem = iActualItem;
lvitem.iSubItem = 3;
lvitem.pszText = sText.GetBuffer(sText.GetLength());
GetListCtrl().SetItem(&lvitem);
}
LPTSTR CDriveExplorerView::GetNTS(CString cString)
{
LPTSTR lpsz = new TCHAR[cString.GetLength()+1];
_tcscpy(lpsz, cString);
return lpsz;
}
CString CDriveExplorerView::GetFileType(CString s)
{
CString cResult;
int nFoundAt = s.Find("." , 0);
s.MakeUpper();
if(nFoundAt == 0)
return s + " File";
CString ext = s.Mid(nFoundAt);
if(ext == ".PDF") return "PDF File";
if(ext == ".CPP") return "VC Source";
if(ext == ".H") return "Header File";
if(ext == ".C") return "C Source";
else if(s == "SETUP.EXE") return "SETUP File";
else if(s == "ISUNINST.EXE") return "UNINSTALL File";
else if(ext == ".TXT" || ext == ".LOG") return "TEXT File";
else if(ext == ".ZIP" || ext == ".ARJ" || ext == ".TGZ" || ext == ".RAR" || ext == ".TAR" || ext == ".LZH" ||
ext == ".LZA" || ext == ".CAB")
return "ZIP File";
else if(ext == ".EXE" || ext == ".COM" || ext == ".BAT")
return "Application";
else if(ext == ".AU" || ext == ".WAV" || ext == ".MP3")
return "SOUND File";
else if(ext == ".HTM" || ext == ".HTML") return "HTML Document";
else if(ext == ".DOC") return "WORD Document";
else if(ext == ".MPG" || ext == ".MPEG" || ext == ".AVI")
return ICI_VIDEOFILE;
else if(ext == ".HLP") return "HELP File";
else if(ext ==