oid CEnumFileDlg::OnEnum()
{
BROWSEINFO bi;
char buffer[MAX_PATH];
ZeroMemory(buffer,MAX_PATH);
bi.hwndOwner=GetSafeHwnd();
bi.pidlRoot=NULL;
bi.pszDisplayName=buffer;
bi.lpszTitle="选择一个文件夹";
bi.ulFlags=BIF_EDITBOX;
bi.lpfn=NULL;
bi.lParam=0;
bi.iImage=0;
LPITEMIDLIST pList=NULL;
if((pList=SHBrowseForFolder(&bi))!=NULL)
{
char path[MAX_PATH];
ZeroMemory(path,MAX_PATH);
SHGetPathFromIDList(pList,path);
CString strPath=path;
CString strtemp;
if(strPath.Right(1)!="\\")
strtemp.Format("%s\\*.*",strPath);
else
strtemp.Format("%s*.*",strPath);
CFileFind findfile;
BOOL bfind=findfile.FindFile(strtemp);
while(bfind)
{
bfind=findfile.FindNextFile();
int i=m_filelist.GetItemCount();
m_filelist.InsertItem(i,"");
m_filelist.SetItemText(i,0,findfile.GetFilePath());
}
}
}