What is the maximum number of files limit in this code?
FIX: Common File Dialog Multiple Selection File Limit http://support.microsoft.com/kb/179372
What is the maximum number of files limit in this code?
FIX: Common File Dialog Multiple Selection File Limit http://support.microsoft.com/kb/179372
The sample code on the page you linked to uses this:
DWORD MAXFILE = 2562;
dlg.m_ofn.nMaxFile = MAXFILE;
char* pc = new char[MAXFILE];
The buffer pc
is 2562 characters long, the number of files that can be opened is limited by this. As long as the total length of all the selected file names together (including path) fit's in these 2562 bytes, it succeedes, otherwise it fails. So the actual number of files possible depends on the length of the file names you want to open.
You can detect if the buffer was to small by checking for FNERR_BUFFERTOOSMALL
:
if(CommDlgExtendedError() == FNERR_BUFFERTOOSMALL) {
// the buffer was to small, not all file names did fit into it
}