CFileDialog的lpszFilter参数

VC中CFileDialog类的lpszFilter参数用来通过后缀过滤文件。每次用,每次都要去查找拷贝,写到这里好找,呵呵。

如果要支持多个后缀,msdn介绍的方法是将上面的参数设成:

szFilter[] = "Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||";

注意:

1、“;”的三和iyongyonglai控制组内项目。

2、最后一个|的用法

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 (|).

原文地址:https://www.cnblogs.com/flyingfish/p/704754.html