请教一个关于资源管理器的问题
<P>.net 2003<BR>我做了个资源管理器的简单MFC程序 可是老是报错<BR>c:\Documents and Settings\dell\My Documents\Visual Studio Projects\FileManager\FolderTreeCtrl.cpp(84): error C2065: “faDirectory” : 未声明的标识符<BR>c:\Documents and Settings\dell\My Documents\Visual Studio Projects\FileManager\FolderTreeCtrl.cpp(48): error C2065: “SearchRec” : 未声明的标识符<BR>c:\Documents and Settings\dell\My Documents\Visual Studio Projects\FileManager\FolderTreeCtrl.cpp(48): error C2065: “TSearchRec” : 未声明的标识符<BR>找了很久也没搞明白怎么声明他们<BR>发现好象是dephi的东东<BR>源程序如下<BR>// FolderTreeCtrl.cpp : 实现文件<BR>//</P><P>#include "stdafx.h"<BR>#include "FileManager.h"<BR>#include "FolderTreeCtrl.h"<BR>#include ".\foldertreectrl.h"</P>
<P><BR>// CFolderTreeCtrl</P>
<P>IMPLEMENT_DYNAMIC(CFolderTreeCtrl, CTreeCtrl)<BR>CFolderTreeCtrl::CFolderTreeCtrl()<BR>{<BR>}</P>
<P>CFolderTreeCtrl::~CFolderTreeCtrl()<BR>{<BR>}</P>
<P><BR>BEGIN_MESSAGE_MAP(CFolderTreeCtrl, CTreeCtrl)<BR>END_MESSAGE_MAP()</P>
<P>// CFolderTreeCtrl 消息处理程序</P>
<P><BR>void CFolderTreeCtrl::ExploreDir(const CString& strDir , HTREEITEM hParent)<BR>{<BR> TV_INSERTSTRUCT tvstruct;<BR> CString strSearchDir;<BR> HTREEITEM hIT=GetChildItem(hParent);<BR> HTREEITEM hTemp;<BR> while(hIT!=NULL)<BR> {<BR> hTemp=GetNextSiblingItem(hIT);<BR> DeleteItem(hIT);<BR> hIT=hTemp;<BR> }<BR> if(hParent!=GetRootItem())<BR> strSearchDir=strDir+_T("\\");<BR> else<BR> strSearchDir="";<BR> BOOL bDir=FALSE;<BR> HTREEITEM hThisItem;<BR> TSearchRec SearchRec;<BR> if(strSearchDir=="")<BR> {<BR> char DriveChar;<BR> UINT DriveType;<BR> char lpRootPathName[256]="";<BR> DWORD DriveBits=(DWORD)GetLogicalDrives();<BR> for(DWORD DriveNum=0,Num=1;DriveNum<26;DriveNum++,Num=Num*2)<BR> {<BR> if((Num&DriveBits)==0) continue;<BR> DriveChar=char(DriveNum)+'a';<BR> memset(lpRootPathName,0,256);<BR> lpRootPathName[0]=DriveChar;<BR> strcat(lpRootPathName,":\\");<BR> DriveType=GetDriveType((LPCTSTR)lpRootPathName);<BR> switch(DriveType)<BR> {<BR> case DRIVE_REMOVABLE;<BR> case DRIVE_FIXED;<BR> case DRIVE_REMOTE;<BR> case DRIVE_CDROM;<BR> case DRIVE_RAMDISK;<BR> bDir=TRUE;<BR> tvstruct.item.iImage =3;<BR> tvstruct.item.iSelectedImage=3;<BR> tvstruct.hParent=hParent;<BR> tvstruct.hInsertAfter=TVI_LAST;<BR> tvstruct.item.pszText =(LPCTSTR)(LPCTSTR)lpRootPathName;<BR> tvstruct.item.mask =TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT;<BR> hThisItem=InsertItem(&tvstruct);<BR> break;<BR> }<BR> }<BR> }<BR> else<BR> {<BR> int Status=YS_FindFirst(SlashSep(strSearchDir,"*.*"),faDirectory,&SearchRec);<BR> TRY<BR> while(Status==0)<BR> {<BR> if((SearchRec.Attr&faDirectory)==faDirectory)<BR> {<BR> if((SearchRec.Name!='.')&&(SearchRec.Name!=".."))<BR> {<BR> bDir=TRUE;<BR> tvstruct.item.iImage =1;<BR> tvstruct.item.iSelectedImage=2;<BR> tvstruct.hParent=hParent;<BR> tvstruct.hInsertAfter=TVI_LAST;<BR> tvstruct.item.pszText =(LPCTSTR)(LPCTSTR)SearchRec.Name;<BR> tvstruct.item.mask =TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT;<BR> hThisItem=InsertItem(&tvstruct);<BR> }<BR> }<BR> Status=YS_FindNext(&SearchRec);<BR> }<BR> CATCH_ALL(e)<BR> YS_FindClose(SearchRec);<BR> END_CATCH_ALL</P>
<P> }<BR> if(bDir)<BR> {<BR> CString strFullSearchPath;<BR> int nImage,nSelectedImage;<BR> hThisItem=GetChildItem(hParent);<BR> CString strDirInfo,strFileName;<BR> while(hThisItem!=NULL)<BR> {<BR> GetItemImage(hThisItem,nImage,nSelectedImage);<BR> if((nImage==1)||(nImage==3))//为目录<BR> {<BR> tvstruct.hParent=hThisItem;<BR> tvstruct.hInsertAfter=TVI_LAST;<BR> tvstruct.item.iImage =1;<BR> tvstruct.item.iSelectedImage=2;<BR> tvstruct.item.pszText =_T("1");<BR> tvstruct.item.mask =TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT;<BR> InsertItem(&tvstruct); <BR> }<BR> hThisItem=GetNextSiblingItem(hThisItem);</P>
<P> }<BR> }<BR> return;<BR>}<BR></P>
页:
[1]
