GetOpenFileName wont open huge list of files

Hi,

I've been having problems with the File Dialog not opening a huge number of files from a directory. I have mapped the network drive to a single drive letter to shortne the path to just J:\ and still hav the same issue.

I always get the error in a message box (EQUCON_667962 is half of one of the filenames)

EQUCON_667962
File not found.
Please verify the correct filename was given.

I've included the directory listing of the files I'm trying to select.

I can stop this error occuring by removng the OFN_FILEMUSTEXIST Flag but the list of files returned by the GetOpenFileName function is still truncated. The same problems occur with the CFileDialog MFC version

BUF_SIZE is (1024 * 1024)

i.e. 1MB, I've tried 10MB and still get the same error.

Here's the code I'm using.

OPENFILENAME ofn;

memset(&ofn, 0, sizeof(ofn));

ofn.Flags = OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER;
//ofn.hInstance = 0;
ofn.hwndOwner = this->m_hWnd;
ofn.lpstrDefExt = _T("cmp");
ofn.lpstrFile = new TCHAR[BUF_SIZE];
ofn.lpstrFilter = _T("CMP Files (*.cmp)|*.cmp|All Files (*.*)|*.*|");
ofn.lStructSize = sizeof(ofn);
ofn.nMaxFile = BUF_SIZE;

memset(ofn.lpstrFile, 0, BUF_SIZE);

if(GetOpenFileName(&ofn))
{
TCHAR szBuffer[MAX_PATH];

_sntprintf(szBuffer, MAX_PATH, _T("GetOpenFilename Failed <%d>"), CommDlgExtendedError());

AfxMessageBox(szBuffer);
}

delete[] ofn.lpstrFile;

BTW I'm using Windows 2000 SP3,
CommDlg.DLL version 3.10.0.103
[1720 byte] By [SJ Smith] at [2007-11-18 20:33:42]
# 1 Re: GetOpenFileName wont open huge list of files
It wont, any how! You need to traverse among files using CFileDialog::GetStartPosition and CFile::GetNextPathName along with regular GetFileName/Path
Ajay Vijay at 2007-11-11 1:12:16 >
# 2 Re: GetOpenFileName wont open huge list of files
It's the initial list of files I can't get, I haven't included the code for the next step where I read through the list of files because the code doesn't get that far.

It won't even return true whilst OFN_FILEMUSTEXIST is specified.
SJ Smith at 2007-11-11 1:13:24 >
# 3 Re: GetOpenFileName wont open huge list of files
I hope Multiple Selection in a File Dialog ( http://www.codeproject.com/dialog/pja_multiselect.asp) can help you.
ovidiucucu at 2007-11-11 1:14:23 >
# 4 Re: GetOpenFileName wont open huge list of files
Still exactly the same problem.

Thanks for the first sensible answer I've had in 3 posts though.
SJ Smith at 2007-11-11 1:15:28 >
# 5 Re: GetOpenFileName wont open huge list of files
check google for that error message. Also , post ur question on some MS newsgroups.

Here's one I found:
http://lists.trolltech.com/qt-interest/2000-01/thread00319-0.html
kirants at 2007-11-11 1:16:30 >
# 6 Re: GetOpenFileName wont open huge list of files
I posted some message last week on the newsgroups.

I have been told that there is a 32K limit to the length of the string returned by the file dialog. Although I haven't seen any Microsoft documenation of this limitation on Windows 2000.
SJ Smith at 2007-11-11 1:17:29 >