这段代码有什么问题吗?

ren20 2001-03-26 07:29:00
编译通过,但是运行出现 “终止” “重试” “忽略”
CFileDialog TFileDlg(TRUE,"*.trk",NULL,OFN_HIDEREADONLY,"Terrain File(*.ter)|*.ter||",NULL);
TFileDlg.m_ofn.Flags=OFN_ALLOWMULTISELECT;
TFileDlg.m_ofn.lpstrFile="Terrain File Dialog ";
TFileDlg.m_ofn.nMaxFile=4096;

if(TFileDlg.DoModal()==IDOK)
{

}
...全文
440 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jans 2001-03-27
  • 打赏
  • 举报
回复
没有分配Buffer嘛
kevin_gao 2001-03-27
  • 打赏
  • 举报
回复
VC+BCB不好吗?都是C++的东西应该不错吧,我以为。虽然BCB我不太懂!
ren20 2001-03-26
  • 打赏
  • 举报
回复
谢谢,我的程序已经好了,多亏了大家的帮助

请问,我原来的程序那里出了问题?
Jans 2001-03-26
  • 打赏
  • 举报
回复
这样好像可以了
char szFiles[4096];
CFileDialog TFileDlg(TRUE,"*.trk",NULL,OFN_HIDEREADONLY,"Terrain File(*.ter)|*.*||",NULL);
TFileDlg.m_ofn.Flags|=OFN_ALLOWMULTISELECT;
strcpy(str," All Files");
TFileDlg.m_ofn.lpstrFile=szFiles;
TFileDlg.m_ofn.nMaxFile=4096;
if(TFileDlg.DoModal()==IDOK)
{

}
Jans 2001-03-26
  • 打赏
  • 举报
回复
Specifies that the File Name list box allows multiple selections. If you also set the OFN_EXPLORER flag, the dialog box uses the Explorer-style user interface; otherwise, it uses the old-style user interface.
If the user selects more than one file, the lpstrFile buffer returns the path to the current directory followed by the file names of the selected files. The nFileOffset member is the offset, in bytes or characters, to the first file name, and the nFileExtension member is not used. For Explorer-style dialog boxes, the directory and file name strings are NULL separated, with an extra NULL character after the last file name. This format enables the Explorer-style dialog boxes to return long file names that include spaces. For old-style dialog boxes, the directory and file name strings are separated by spaces and the function uses short file names for file names with spaces. You can use the FindFirstFile function to convert between long and short file names.

If you specify a custom template for an old-style dialog box, the definition of the File Name list box must contain the LBS_EXTENDEDSEL value.
ren20 2001-03-26
  • 打赏
  • 举报
回复
能不能当对话框打开时, 设置缺省目录为 d:\abc
ren20 2001-03-26
  • 打赏
  • 举报
回复
对话框只显示 扩展名为 trk 的文件。
joke100 2001-03-26
  • 打赏
  • 举报
回复
是不是搞错了呀。。。

char bigBuff[2048] = ""; // maximum common dialog buffer size
char szFilter[] =
"All Files (*.*)|*.*|Text Files (*.txt)|*.txt||";
CFileDialog dlg(TRUE, NULL, NULL,
OFN_ALLOWMULTISELECT, szFilter);

// Modify OPENFILENAME members directly to point to bigBuff
dlg.m_ofn.lpstrFile = bigBuff;
dlg.m_ofn.nMaxFile = sizeof(bigBuff);

dlg.DoModal();
ren20 2001-03-26
  • 打赏
  • 举报
回复
TFileDlg.m_ofn.Flags=OFN_ALLOWMULTISELECT;
TFileDlg.m_ofn.lpstrFile="Terrain File Dialog ";
TFileDlg.m_ofn.nMaxFile=4096;

我把这3句去掉,就可以运行了,怎么回事?
ren20 2001-03-26
  • 打赏
  • 举报
回复
怎么改,高手?
joke100 2001-03-26
  • 打赏
  • 举报
回复
If the OFN_ALLOWMULTISELECT flag is set and the user selects multiple files, the m_ofn.lpstrFile contains the current directory followed by the file names of the selected files.
ren20 2001-03-26
  • 打赏
  • 举报
回复
2位的方法还是不行呀
panda_w 2001-03-26
  • 打赏
  • 举报
回复
把最后参数改为this试试
joke100 2001-03-26
  • 打赏
  • 举报
回复
增加一句
TFileDlg.m_ofn.hInstance = AfxGetInstanceHandle();


随机开仓,止盈1~2个点,止损1~20个点能实现盈利正期望吗?《从编程小白到量化宗师之路》系列课程是一套综合性实战课程,涵盖股票,期货,虚拟货币等的交易方法和策略手段。《m单位止盈 n单位止损的方式,能不能实现盈利?》是本系列的第四个中级课程。本网站的课程宗旨是缩短个人或小型投资者与大型机构投资者之间的的差距。课程内容从交易者经常见到,经常思考的问题开始,通过分析成交后的盈亏分布,建立模型,刻画问题,并对问题以数学的方式进行了表达。从而得出结论。与市面上的其他理论课程不同,本课程注重实战,注重结果,全部模型代码均已经上传发表,学员上课后,可以使用自己的tick数据,进行分析。如果获取tick数据有疑问,可以参考课程:《期货CTP高频数据Tick下载》 https://edu.csdn.net/course/detail/24783本课程能够解答的问题有:1)请问1单位止盈,3单位止损的系统是否能实现正期望值? https://www.zhihu.com/question/423194389/answer/14989174122)抢帽子交易是什么意思?为什么有的人能够成功,说是取款机,而有的人说风险巨大,是老虎机。看过这个课程,您将会知道:a) 这类问题的究极解决方案,直达问题核心,不再纠结原因b)构建一段时间可用的交易策略c)知道“没有不变的策略”的原因  

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧