1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
void Cwindows_checkerDlg::OnBnClickedRechLast()
{
// TODO: Add your control notification handler code here
// on cherche les derniers fichiers modifiés et on les affiche dans la listbox
int count = m_listedefichiers.GetCount(); //vider la liste
while(count > -1)
{
m_listedefichiers.DeleteString(count); // ya pas autre chose pour effacer une listbox ?
count--; // on décremente
}
CFileFind finder;
CTime timDateCreation ;
CString strDateCreation ;
CString strNomDeFichier ;
UpdateData(TRUE); // prise en compte de l'extention de fichier a chercher
BOOL bWorking = finder.FindFile(m_extension); // va cherhcer lycos
while (bWorking) // tant qui trouve, il rempli la listebox
{
bWorking = finder.FindNextFile(); // cherche le suivant
if(finder.IsDirectory() == 0)
{
strNomDeFichier = ((LPCTSTR) finder.GetFileName()) ;
finder.GetLastWriteTime(timDateCreation);
strDateCreation = timDateCreation.Format( "Modifié le %Y-%m-%d à %H:%M " );
strDateCreation += strNomDeFichier ;
m_listedefichiers.AddString((LPCTSTR) strDateCreation);
}
}
} |
Partager