本文介绍了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.

推荐答案



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

09-15 06:05