File Open Dialog with Multiple Selection – Part 3: Cutting the Dog Tail

First two articles in this series show how to deal with a large number of selected items, by manipulating the OPENFILENAME::lpstrFile buffer, either for old style or Vista-style Open File dialogs. However, if the target system is Windows Vista or newer, we should prefer getting rid of old stuff and use only Vista-style dialogs. So, … Read more

File Open Dialog with Multiple Selection – Part 2: Vista Style

As told in the previous article, if the Open File dialog has Vista style, it’s not possible to use common dialog box messages like CDM_GETFOLDERPATH and CDM_GETSPEC in order to calculate the necessary buffer size, for multiple selection. Instead, we can use Common Item Dialog API, in our case IFileOpenDialog interface. Using IFileOpenDialog interface Here … Read more

File Open Dialog with Multiple Selection – Part 1: Old Style

One common beginner’s mistake Someone may use the following code to show a File Open dialog: Example 1 CFileDialog dlgOpenFile(TRUE); dlgOpenFile.GetOFN().Flags |= OFN_ALLOWMULTISELECT; if(IDOK == dlgOpenFile.DoModal()) { // get selected files POSITION pos = dlgOpenFile.GetStartPosition(); while(NULL != pos) { CString strFilePath = dlgOpenFile.GetNextPathName(pos); // … do something with strFilePath. } } Setting OFN_ALLOWMULTISELECT flag tells … Read more

MFC-extension WIC File Dialogs

A previous article showed how to enumerate WIC (Windows Imaging Component) codecs, that are available in system. Now, let’s use the codecs list in order to make File Open and File Save As dialogs which are dealing with WIC-compliant image files, i.e. having “File of type” filter list according to available WIC codecs (see the images, below).   CWICFileDialog class … Read more