void ProgressShow::CreateFolder(CString cstrSFolder, CString cstrDFolder)
{
structFPath sFPath;
CString cstrTemp;
CString sFileName,dFileName,sFile;
UF_PART_load_status_t error_status;
int unit=1;
tag_t part1;
int scope=1;
int mode=1;
CArray<structFPath,structFPath[$> myArray]
CString sPath=cstrSFolder;
CFileFind tempFind; //声明一个CFileFind类变量,以用来搜索
char tempFileFind[200]; //用于定义搜索格式
sprintf(tempFileFind,"%s\\*.*",cstrSFolder);//匹配格式为*.*,即该目录下的所有文件
BOOL IsFinded=(BOOL)tempFind.FindFile(tempFileFind);//查找第一个文件
while(IsFinded)
{
IsFinded=(BOOL)tempFind.FindNextFile();//递归搜索其他的文件
if(!tempFind.IsDots())//如果不是"."目录
{
cstrSFolder=tempFind.GetFilePath();
cstrTemp=cstrDFolder + "\\" + tempFind.GetFileTitle();
if (tempFind.IsDirectory())
{
LPTSTR lprCopyTo=new char[255];
lstrcpy(lprCopyTo,cstrTemp);//目标文件夹
sPath=lprCopyTo;
CreateDirectory(lprCopyTo,NULL);
sFPath.SPath=cstrSFolder;
sFPath.DPath=cstrTemp;
myArray.Add(sFPath);
}
else
{
CString FileTitle=tempFind.GetFileTitle();
sFileName=tempFind.GetFilePath();
sFile=tempFind.GetFileName();
dFileName=cstrDFolder + "\\" + sFile;
if (equalDxf(sFileName))
{
int err=UF_PART_open(sFileName,[$part1,&error_status)]
if(err==0)
{
UF_PART_save_as(dFileName);
}
else
{
DealError(CurPath,sFileName);
}
CString tempFile=FileTitle+"_dxf.prt";
CString filePath=sPath+"\\"+tempFile;
deleteFile(filePath);
CString fileLog=sPath+"\\"+FileTitle+".log";
deleteFile(fileLog);
CString fileSummary=sPath+"\\"+FileTitle+"_dxf_summary.log";
deleteFile(fileSummary);
iCurFileNum=iCurFileNum+1;
m_CurFile.SetWindowText(sFileName);
DealProgress();
}
}
}
CheckMessageQueue();
}
tempFind.Close();
CheckMessageQueue();
while (myArray.GetSize()!=0)
{
sFPath=myArray.GetAt(0);
myArray.RemoveAt(0,1);
CreateFolder(sFPath.SPath,sFPath.DPath);
}
}
这是我的一个按钮转换函数,涉及UG的是从open以后开始的 |