BOOL CAgendaDlg::DeleteDirectory(char *DirName)
{
CFileFind tempFind;
char tempFileFind[200];
sprintf(tempFileFind,"%s//*.*",DirName);//Àý:c://test
BOOL IsFinded=(BOOL)tempFind.FindFile(tempFileFind);//ÕÒµ½Â·¾¶Óë·ñ
while(IsFinded)
{
IsFinded=(BOOL)tempFind.FindNextFile();//½Ó×Å´Óµ±Ç°Â·¾¶ËÑË÷
if(!tempFind.IsDots())//»¹ÊÇ·¾¶
{
char foundFileName[200];
strcpy(foundFileName,tempFind.GetFileName().GetBuffer(200));
if(tempFind.IsDirectory())//ÊÇÎļþ¼ÐÔòÉîËÑ
{
char tempDir[200];
sprintf(tempDir,"%s//%s",DirName,foundFileName);
DeleteDirectory(tempDir);
}
else//ÊÇÎļþÔòɾ³ý
{
char tempFileName[200];
sprintf(tempFileName,"%s//%s",DirName,foundFileName);
DeleteFile(tempFileName);
}
}
}
tempFind.Close();
// if(!RemovwDirctory(DirName))
// {
// MessageBox("ɾ³ýĿ¼ʧ°Ü");
// return FALSE;
// }
return TRUE;
{
CFileFind tempFind;
char tempFileFind[200];
sprintf(tempFileFind,"%s//*.*",DirName);//Àý:c://test
BOOL IsFinded=(BOOL)tempFind.FindFile(tempFileFind);//ÕÒµ½Â·¾¶Óë·ñ
while(IsFinded)
{
IsFinded=(BOOL)tempFind.FindNextFile();//½Ó×Å´Óµ±Ç°Â·¾¶ËÑË÷
if(!tempFind.IsDots())//»¹ÊÇ·¾¶
{
char foundFileName[200];
strcpy(foundFileName,tempFind.GetFileName().GetBuffer(200));
if(tempFind.IsDirectory())//ÊÇÎļþ¼ÐÔòÉîËÑ
{
char tempDir[200];
sprintf(tempDir,"%s//%s",DirName,foundFileName);
DeleteDirectory(tempDir);
}
else//ÊÇÎļþÔòɾ³ý
{
char tempFileName[200];
sprintf(tempFileName,"%s//%s",DirName,foundFileName);
DeleteFile(tempFileName);
}
}
}
tempFind.Close();
// if(!RemovwDirctory(DirName))
// {
// MessageBox("ɾ³ýĿ¼ʧ°Ü");
// return FALSE;
// }
return TRUE;