FindFirstChangeNotification
FindNextChangeNotification
这两个函数用来监视一个指定目录的变化情况,具体请看一下MSDN
FindNextChangeNotification
这两个函数用来监视一个指定目录的变化情况,具体请看一下MSDN
解决方案 »
- 关于自画菜单处理WM_DRAWITEM消息的疑问,求有经验的人帮助~
- 菜单的消息响应函数不响应
- 光标问题
- (新手)vs2003 创建MFC activex 控件 怎样用向导生成一个能传递字符串参数的函数呀???
- CComboBox如何向上拉出列表
- 静态函数和非静态函数的区别是什么?为什么要用静态函数呢?
- 我得vc include里边没有hid.h这个头文件
- 数据库连接问题
- 在程序里怎样调用int WINAPI KDAPI_Request(tagREQUEST &request);函数?
- 在R、G、B三通道融合以求增强对比度的时候相关性会有影响吗?
- Linux下的c语言问题(在线恭候)
- 100分!抢吧,但10个小时过去了,还没有人回答。。。
CString strDllName;
Cstring full_strDllName;
int itemIndex;SetCurrentDirectory("pluginDirectory");
BOOL bWorking = finder.FindFile("*.dll");
m_fList.RemoveAll(); //这里m_fList是CStringList的一个对象
itemIndex=2;
ii=0;
while (bWorking)
{
bWorking = finder.FindNextFile();
strDllName=finder.GetFileName();
m_fList.AddTail(strDllName);
}
那样可以发现文件的变化,但怎么获得新增加的文件的文件名呢
to batizhou(batizhou)
不知CStringList是否有序,能不能重复插入同一值
BOOL ***::DeleteFoldFile(char *path)
{
struct _finddata_t c_file;
long hFile;
BOOL flag;
int i = 0;
CWaitCursor wait;
/* Find first .c file in current directory */
char fullpath[1024];
CString ppp;
sprintf(fullpath,"%s\\*.*",path);
flag = FALSE;
char curpath[1024];
if( (hFile = _findfirst( fullpath, &c_file )) == -1L )
{
return FALSE;
}
else
{
sprintf(curpath,"%s\\%s",path,c_file.name);
if(c_file.attrib == _A_SUBDIR && c_file.name[0] != '.')
{
//is a fold.
if(DeleteFoldFile(curpath))
flag = TRUE;
}
else if(c_file.name[0] != '.')
{
//is a file.
//do what you want do.
}
while( _findnext( hFile, &c_file ) == 0 )
{
sprintf(curpath,"%s\\%s",path,c_file.name);
if(c_file.attrib == _A_SUBDIR && c_file.name[0] != '.')
{
if(DeleteFoldFile(curpath))
flag = TRUE;
}
else if(c_file.name[0] != '.')
{
//is a file.
//do what you want do.
}
}
}
_findclose( hFile );
return flag;
}
x001.dat,x002.dat,x003.dat,x004.dat……x020.dat
而在B目录下依次得出的文件是
x370.dat,x356.dat,x357.dat,x358.dat,……x368.dat,x369.dat,x355.dat,
注:文件的创建日期顺序和文件名的顺序一致。
排序本不困难,但是对文件又不是搜索一次,而是找出新创建的还没有处理的。不过看来只有这样了。
HANDLE hFind=::FindFirsFile(_T("yourpath\\*.*"),&fid);
if (hFind!=INVALID_HANDLE_VALUE) {
do {
if (!(fid.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
AfxMessageBox(fid.cFileName);//or do anything u want
}while (::FindNextFile(hFind,&fid));
::FindClose(hFind);
}
通过低归实现遍历
FindFirsFile,FindNextFile,FindClose是什么函数啊,要加什么头文件,在MSDN中为什么找不到?另外他找出的文件有什么顺序规律吗?你说的低归实现遍历是什么意思啊?能不能具体一点,谢谢!