I'm trying to apply file's extension filters to the file's selection dialog.
This way works:
ofn.lpstrFilter =
"(*.exe) Windows Executable\0*.exe\0"
"(*.ini) Windows Initialization file \0*.ini\0"
"(*.dll) Dynamic Link Library \0*.dll\0"
"(*.lib) Windows Library file \0*.lib\0"
"(*.conf) Windows Configuration file \0*.conf\0";
But when I'm assigning extension filters dynamically, via parameters, it fails, filters don't appear in the combo box:
LPCSTR filter = (LPCSTR)extFilter; //Contains string "bmp"
stringstream s;
s << "(*.exe) Windows Executable\0" << "*." << filter << "\0";
string ffilter = s.str();
ofn.lpstrFilter = ffilter.c_str();
I'm assuming the problem is in strings conversion, but can't figure it out.