几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(C++) (http://www.dimcax.com/hust/forumdisplay.php?f=34)
-   -   【转帖】关于cfiledialog的应用(多选文件)................. (http://www.dimcax.com/hust/showthread.php?t=7141)

yang686526 2009-04-16 08:01 PM

【转帖】关于cfiledialog的应用(多选文件).................
 
关于cfiledialog的应用(多选文件).................
关于cfiledialog的应用(多选文件).................
cstring filepath;
cfiledialog file(true,0,0,ofn_allowmultiselect | ofn_enablesizing);
if(file.domodal() == idcancel)
return;
position pos = file.getstartposition();
while(pos != null)
{
filepath = file.getnextpathname(pos);
if(m_list.findstring(0,filepath) == -1)
{
m_list.addstring(filepath);
}
}
为什么有时候多选文件的时候选不上?
cfiledialog自己有个存储选中的文件名和路径名的buffer, 不过默认只有256个字符长, 多选的时候所有的文件名和路径名连在一起如果长于256个字符, 多出的部分就会被无视..
用ofn_allowmultiselect的时候用户必须自己设立足够大的buffer空间, 然后告诉cfiledialog使用用户的buffer存储选中的文件/路径名.
参考vc++ msdn下的cfiledialog, m_ofn, lpstrfile, nmaxfile项目.
virtue is like a rich stone, best plain set.
-- francis bacon, <of beauty>
问题已经解决,谢谢楼上的.......................


所有的时间均为北京时间。 现在的时间是 05:54 AM.