| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1767 人关注过本帖
标题:请教一个关于资源管理器的问题
只看楼主 加入收藏
lfzhang
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-11-8
收藏
 问题点数:0 回复次数:0 
请教一个关于资源管理器的问题

.net 2003
我做了个资源管理器的简单MFC程序 可是老是报错
c:\Documents and Settings\dell\My Documents\Visual Studio Projects\FileManager\FolderTreeCtrl.cpp(84): error C2065: “faDirectory” : 未声明的标识符
c:\Documents and Settings\dell\My Documents\Visual Studio Projects\FileManager\FolderTreeCtrl.cpp(48): error C2065: “SearchRec” : 未声明的标识符
c:\Documents and Settings\dell\My Documents\Visual Studio Projects\FileManager\FolderTreeCtrl.cpp(48): error C2065: “TSearchRec” : 未声明的标识符
找了很久也没搞明白怎么声明他们
发现好象是dephi的东东
源程序如下
// FolderTreeCtrl.cpp : 实现文件
//

#include "stdafx.h"
#include "FileManager.h"
#include "FolderTreeCtrl.h"
#include ".\foldertreectrl.h"


// CFolderTreeCtrl

IMPLEMENT_DYNAMIC(CFolderTreeCtrl, CTreeCtrl)
CFolderTreeCtrl::CFolderTreeCtrl()
{
}

CFolderTreeCtrl::~CFolderTreeCtrl()
{
}


BEGIN_MESSAGE_MAP(CFolderTreeCtrl, CTreeCtrl)
END_MESSAGE_MAP()

// CFolderTreeCtrl 消息处理程序


void CFolderTreeCtrl::ExploreDir(const CString& strDir , HTREEITEM hParent)
{
TV_INSERTSTRUCT tvstruct;
CString strSearchDir;
HTREEITEM hIT=GetChildItem(hParent);
HTREEITEM hTemp;
while(hIT!=NULL)
{
hTemp=GetNextSiblingItem(hIT);
DeleteItem(hIT);
hIT=hTemp;
}
if(hParent!=GetRootItem())
strSearchDir=strDir+_T("\\");
else
strSearchDir="";
BOOL bDir=FALSE;
HTREEITEM hThisItem;
TSearchRec SearchRec;
if(strSearchDir=="")
{
char DriveChar;
UINT DriveType;
char lpRootPathName[256]="";
DWORD DriveBits=(DWORD)GetLogicalDrives();
for(DWORD DriveNum=0,Num=1;DriveNum<26;DriveNum++,Num=Num*2)
{
if((Num&DriveBits)==0) continue;
DriveChar=char(DriveNum)+'a';
memset(lpRootPathName,0,256);
lpRootPathName[0]=DriveChar;
strcat(lpRootPathName,":\\");
DriveType=GetDriveType((LPCTSTR)lpRootPathName);
switch(DriveType)
{
case DRIVE_REMOVABLE;
case DRIVE_FIXED;
case DRIVE_REMOTE;
case DRIVE_CDROM;
case DRIVE_RAMDISK;
bDir=TRUE;
tvstruct.item.iImage =3;
tvstruct.item.iSelectedImage=3;
tvstruct.hParent=hParent;
tvstruct.hInsertAfter=TVI_LAST;
tvstruct.item.pszText =(LPCTSTR)(LPCTSTR)lpRootPathName;
tvstruct.item.mask =TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT;
hThisItem=InsertItem(&tvstruct);
break;
}
}
}
else
{
int Status=YS_FindFirst(SlashSep(strSearchDir,"*.*"),faDirectory,&SearchRec);
TRY
while(Status==0)
{
if((SearchRec.Attr&faDirectory)==faDirectory)
{
if((SearchRec.Name!='.')&&(SearchRec.Name!=".."))
{
bDir=TRUE;
tvstruct.item.iImage =1;
tvstruct.item.iSelectedImage=2;
tvstruct.hParent=hParent;
tvstruct.hInsertAfter=TVI_LAST;
tvstruct.item.pszText =(LPCTSTR)(LPCTSTR)SearchRec.Name;
tvstruct.item.mask =TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT;
hThisItem=InsertItem(&tvstruct);
}
}
Status=YS_FindNext(&SearchRec);
}
CATCH_ALL(e)
YS_FindClose(SearchRec);
END_CATCH_ALL

}
if(bDir)
{
CString strFullSearchPath;
int nImage,nSelectedImage;
hThisItem=GetChildItem(hParent);
CString strDirInfo,strFileName;
while(hThisItem!=NULL)
{
GetItemImage(hThisItem,nImage,nSelectedImage);
if((nImage==1)||(nImage==3))//为目录
{
tvstruct.hParent=hThisItem;
tvstruct.hInsertAfter=TVI_LAST;
tvstruct.item.iImage =1;
tvstruct.item.iSelectedImage=2;
tvstruct.item.pszText =_T("1");
tvstruct.item.mask =TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_TEXT;
InsertItem(&tvstruct);
}
hThisItem=GetNextSiblingItem(hThisItem);

}
}
return;
}

搜索更多相关主题的帖子: 资源管理器 Documents cpp Studio dell 
2006-11-08 14:41
快速回复:请教一个关于资源管理器的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015940 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved