Home > other >  c , OpenFileDialog.Filter, file name
c , OpenFileDialog.Filter, file name

Time:08-29

I need to use Openfile dialog box and want to filter CSV files starting with some specific alphabet, e.g.,"m"-> myspecific.csv

How can I do it?

OPENFILENAME ofn;
ofn.lpstrFile[0] = '\0';
ofn.lpstrFilter = L"CSV Files (*.csv)\0*.csv\0All Files (*.*)\0*.*\0";// How to add "m" in filter and what is role of \0 here?

CodePudding user response:

You must put the letter before the star.

ofn.lpstrFilter = L"CSV Files (*.csv)\0m*.csv\0All Files (*.*)\0*.*\0";
  • Related