Article ID: 179372
Article Last Modified on 7/11/2005
#include "cderr.h" //for definition of FNERR_BUFFERTOOSMALL
CFileDialog dlg( TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, NULL, NULL );
DWORD MAXFILE = 2562; //2562 is the max
dlg.m_ofn.nMaxFile = MAXFILE;
char* pc = new char[MAXFILE];
dlg.m_ofn.lpstrFile = pc;
dlg.m_ofn.lpstrFile[0] = NULL;
int iReturn = dlg.DoModal();
if(iReturn == IDOK)
{
int nCount = 0;
POSITION pos = dlg.GetStartPosition();
while (pos != NULL)
{
dlg.GetNextPathName(pos);
nCount++;
}
CString str;
str.Format("Successfully opened %d files\n", nCount);
AfxMessageBox(str);
}
else if(iReturn == IDCANCEL)
AfxMessageBox("Cancel");
if(CommDlgExtendedError() == FNERR_BUFFERTOOSMALL)
AfxMessageBox("BUFFERTOOSMALL");
delete []pc;
Additional query words: CFileDialog OFN_ALLOWMULTISELECT OPENFILENAME nMaxFile lpstrFile Common File Dialog limit max GetOpenFileName
Keywords: kbbug kbfix kboswinnt400sp2fix kbcmndlgfileo kbcmndlg kbcode kbcmndlgsave KB179372