📄 subject_49699.htm
字号:
<p>
序号:49699 发表者:往事如风 发表日期:2003-08-13 09:52:31
<br>主题:请教大家一个问题,是关于CFileDialog的!
<br>内容: 下面是一段源码:<BR> CString file[1000];<BR> CString strFile="";<BR> int num = 0;<BR> CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT,"All File (*.ttl)|*.ttl||",NULL);<BR> dlg.m_ofn.nMaxFile = 1000;<BR> dlg.m_ofn.lpstrFileTitle = NULL;<BR><BR> if(dlg.DoModal() == IDOK)<BR> {<BR> POSITION pos = dlg.GetStartPosition();<BR> while(pos!=NULL)<BR> {<BR> file[num] = dlg.GetNextPathName(pos);<BR> num++;<BR> }<BR> }<BR>这段程序就是把所选择的文件名依次赋值给file[num],因为文件很多,所以我给nMaxfile赋值了较大的1000值,缺省是256,结果就出错了,望哪位大虾能够赐教。!而且我在后面用循环语句也出错,:(
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:ax 回复日期:2003-08-13 10:59:43
<br>内容: CString file[1000];<BR> TCHAR str[2048]= _T("");<BR> CString strFile="";<BR> int num = 0;<BR> CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY|OFN_ALLOWMULTISELECT,"All File (*.ttl)|*.ttl||",NULL);<BR> dlg.m_ofn.nMaxFile = 2048;<BR> dlg.m_ofn.lpstrFileTitle = NULL;<BR> dlg.m_ofn.lpstrFile = str;<BR><BR> if(dlg.DoModal() == IDOK)<BR> {<BR> POSITION pos = dlg.GetStartPosition();<BR> while(pos!=NULL)<BR> {<BR> file[num] = dlg.GetNextPathName(pos);<BR> num++;<BR> }<BR> }
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:往事如风 回复日期:2003-08-13 13:03:11
<br>内容: 谢谢,这个是正确答案!<BR><BR>:)
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -