- UID
- 3650
- 积分
- 134
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-4-6
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2002-7-1 18:01:57
|
显示全部楼层
请斑竹和网有帮我吧!我做不完了!
char szPathStr[_MAX_PATH];
POSITION pos;
CString flename;
GetCurrentDirectory(_MAX_PATH,szPathStr);
CFileDialog dlg(true, _T("dwg"), NULL, OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT|OFN_EXPLORER|OFN_NOVALIDATE ,_T("DWG (*.dwg)|*.dwg||"),this);
if (dlg.DoModal()==IDOK)
{
SetCurrentDirectory(szPathStr);
if(LastPtr!=0)
{//AfxMessageBox("xyzt");
delete ListPtr;
ListPtr=0;
FirstPtr=0;
LastPtr=0;
m_thumb1.SetDwgFileName("");
m_thumb1.Refresh();
m_thumb2.SetDwgFileName("");
m_thumb2.Refresh();
m_thumb3.SetDwgFileName("");
m_thumb3.Refresh();
m_thumb4.SetDwgFileName("");
m_thumb4.Refresh();
m_thumb5.SetDwgFileName("");
m_thumb5.Refresh();
}
Number=0;
pos=dlg.GetStartPosition();
while(pos!=NULL)
{
Number++;
ListPtr=new StringList;
flename=dlg.GetNextPathName(pos);
ListPtr->filestring=flename;
ListPtr->Next=0;
AfxMessageBox(flename);
if(LastPtr)
LastPtr->Next=ListPtr;
else
FirstPtr=ListPtr;
LastPtr=ListPtr;
}
////////////////////////这段代码有问题,不能打开10个以上的带有-、空格、汉字的文件
/////原因是GetNextPathName(pos)得到的文件名是乱码
// TODO: Add your control notification handler code here
ListPtr=FirstPtr;
CString str;
if(ListPtr)
{
str=ListPtr->filestring;
m_thumb1.SetDwgFileName(str);
ListPtr=ListPtr->Next;
}
else{m_thumb1.SetDwgFileName("");}
if(ListPtr)
{
str=ListPtr->filestring;
m_thumb2.SetDwgFileName(str);
ListPtr=ListPtr->Next;
}
else{m_thumb2.SetDwgFileName("");}
if(ListPtr)
{
str=ListPtr->filestring;
m_thumb3.SetDwgFileName(str);
ListPtr=ListPtr->Next;
}
else{m_thumb3.SetDwgFileName("");}
if(ListPtr)
{
str=ListPtr->filestring;
m_thumb4.SetDwgFileName(str);
ListPtr=ListPtr->Next;
}
else{m_thumb4.SetDwgFileName("");}
if(ListPtr)
{
str=ListPtr->filestring;
m_thumb5.SetDwgFileName(str);
ListPtr=ListPtr->Next;
}
else{m_thumb5.SetDwgFileName("");}
}
} |
|