CFileDialog不拒绝'>' [英] CFileDialog not rejecting '>'

查看:101
本文介绍了CFileDialog不拒绝'>'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,我的软件测试人员遇到了一个非常奇怪的错误.我一直在使用CFileDialog创建多个另存为"对话框,他发现,尽管文件名中包含<:*?",但它可以使您停止保存,但允许>" '.

我可以用:
复制它

Yesterday my software tester came across a very strange bug. I''ve been using CFileDialog for several Save As dialogs and he''s found that although it stops you being able to save if you have ''<:*?'' in the filename, it allows ''>''.

I can reproduce this just with :

CFileDialog dlg(FALSE);
if(dlg.DoModal() == IDOK)
{
    // By entering ''>'' for the filename and pressing "Save" I get here
}



我正在将VS2008 Standard与Win SDK v6.0a一起使用.昨天我花了相当长的时间搜索以找到一种解释或解决方案,但找不到.我现在通过派生一个自定义CFileDialog来修复该错误,该CFileDialog会覆盖OnFileNameOK()并捕获>"字符.它不是很漂亮,我也不是很满意,因为它忽略了问题的根源,即CFileDialog没有做应做的事情.

还有其他人遇到这个问题吗,或者我会生气吗?我很高兴接受我所做的巨大成就.如果有人能对发生的事情以及如何使CFileDialog正常工作有所了解,我将不胜感激.
谢谢.



I''m using VS2008 Standard with Win SDK v6.0a. I spent quite a while searching yesterday to find an explanation or solution, but couldn''t find one. I''ve fixed the bug for now by deriving a custom CFileDialog which just overrides OnFileNameOK() and catches the ''>'' character. It''s not very pretty and I''m not entirely happy with it because it ignores the source of the problem which is that CFileDialog isn''t doing what it should.

Has anybody else come across this, or am I going mad? I''d be quite happy to accept that I''ve done something monumentally dumb. If anyone can shed any light on what''s going on and how to make CFileDialog work as it should, I''d be really grateful.
Thanks.

推荐答案

我不使用MFC,而是尝试使用GetSaveFileName()函数重现它,我想这是CFileDialog()在幕后使用的功能.在每种情况下,都不允许在文件名中使用>"符号.我想知道您的本地语言设置是否接受该字符作为文件名中的合法字符,或者是否存在其他使它看起来像有效字符的字符.我建议尝试在系统上使用GetSaveFileName()来查看是否获得相同的结果.

我承认我在这里抓着稻草,但只是想着要看的地方.
I do not use MFC but tried to reproduce this using the GetSaveFileName() function, which is, I guess, what CFileDialog() uses under the covers. In every case it would not allow the ''>'' sign in the filename. I wonder if your local language setting accepts this character as legal in a filename, or if there is something else that makes it look like a valid character. I would suggest trying the GetSaveFileName() on your system to see if you get the same results.

I admit I''m clutching at straws here but just trying to think of places to look.


谢谢你的建议.很抱歉延迟回复-我一直在经历迁移到新开发机器的乐趣.

在此过程中,我将代码移到了我的新计算机上,只是让我更加困惑,在新计算机上编译时,该错误不再存在.

如果有机会,我将进一步研究它,然后将发布的内容发布出来.
Thanks for the suggestion. Sorry for the delay in responding - I''ve been going through the joys of moving across to a new development machine.

In the course of this process, I''ve moved the code onto my new machine and just to confuse me even further, the bug is no longer present when compiled on the new machine.

I''m going to look into it a bit further when I get chance and then I''ll post up what I find then.


这篇关于CFileDialog不拒绝'&gt;'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆