C/C++/MFC
		
FILE 파일 리스트 가져오기
2009.06.16 13:17
파일 리스트를 가져오는 예제 입니다.
- 전체 소스 : WATFileList_src.zip
- 실행파일 : WATFileList_EXE.zip
     
 
void CFileListDlg::OnReadButton() 
{
    ClearFileList();
    
    UpdateData(TRUE);
    CFileFind finder;
    CString strPath,strTest;
    SHFILEINFO shInfo;
    LIST_ITEM* pListItem;
    pListItem=new LIST_ITEM;    
    strPath = m_strPath+":\\";
    strPath+="*.*";
    CString strFileSize;
    CFileStatus fStatus;
    if( finder.FindFile(strPath) )
    {
        BOOL bFlag=true;
        
        while(bFlag)
        {
            bFlag=finder.FindNextFile();
            SHGetFileInfo(finder.GetFilePath(),0,&shInfo,sizeof(SHFILEINFO),SHGFI_TYPENAME|SHGFI_SYSICONINDEX);
            if(!finder.IsDots())
            {
                CFile::GetStatus(finder.GetFilePath(),fStatus);
                pListItem->strName = finder.GetFileName();
                pListItem->dwFullSize = finder.GetLength();
                strFileSize.Format("%d",pListItem->dwFullSize);
                m_listFile.InsertRow(m_listFile.GetItemCount(),2,pListItem->strName,strFileSize);                    
            }
        }
    }        
}

 
	
		 


 
    
 
    
 
     
