CFileFind cFinder;

SHFILEINFO sfi;

BOOL bWorking;

int index = 0;

HIMAGELIST hImageList;

hImageList = ( HIMAGELIST )SHGetFileInfo( *pFolder, 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON );

if( hImageList )

{

  m_imgShareSmall.Attach( hImageList );

}

else

{

::AfxMessageBox( "파일을 갖고 올 수 없습니다." );

return -1;

}


m_CListCtrlFileList.DeleteAllItems();

m_CListCtrlFileList.SetImageList( &m_imgShareSmall, LVSIL_SMALL );

*pFolder += "\\*.*";

bWorking = cFinder.FindFile( *pFolder );


while( bWorking )

{

bWorking = cFinder.FindNextFile();

SHGetFileInfo( cFinder.GetFilePath(), 0, &sfi, sizeof( SHFILEINFO ), 

SHGFI_DISPLAYNAME | SHGFI_TYPENAME | SHGFI_SYSICONINDEX | SHGFI_SMALLICON ); 

m_CListCtrlFileList.InsertItem( index, sfi.szDisplayName, sfi.iIcon );


if( !cFinder.IsDirectory() )

{

m_CListCtrlFileList.SetItemText( index++, 1, "파일" );

}


else

{

m_CListCtrlFileList.SetItemText( index++, 1, "폴더" );

}

}


m_imgShareSmall.Detach();


+ Recent posts