CFileDialog设置多个文件类型filter的问题

来源:互联网 发布:xmind 8 pro 破解 mac 编辑:程序博客网 时间:2024/06/16 09:07
调用一个CFileDialog类,它的lpszFilter参数用来通过后缀过滤文件。
如果要支持多个后缀,msdn介绍的方法是将上面的参数设成:
szFilter[] = "Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||";
 
我试了很长时间都失败了。最后才发现,msdn下面还有一行Note:

Note, however, that if you plan to use this string to directly update the OPENFILENAME structure, you should delimit your strings with the null character, (/0), instead of the vertical bar (|).

原创粉丝点击