multi-select for CFileDialog

hi all,
the CFileDialog probably has a limitation of the qountity of files it can choose in one iteration of multi-select. when it exceeds the num of files it can choose, the DoModal returns IDCANCEL, and I have no way of knowing why it failed.
my question is how can I tell after the DoModal() failed that it is due to the num of files that were picked, and not because user simply clicked "Cancel"?
10x, RanBN
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RanBNAuthor Commented:
Edited text of question.
Call the ::CommDlgExtendedError function.
If you follow Chensu's comment you will get the error : FNERR_BUFFERTOOSMALL

This is because CFileDialog set the buffer which stores the file names(lpstrFile member of OPENFILENAME struct) to 260 chars.

You can derive a class from CFileDialog and set the buffer size to what you want.

RanBNAuthor Commented:
10x both,
Can you give an example? I tried playing with it, allocating memory, defining the nMaxFile field,  and I managed to pick multy files. but still I have 2 problems:
1. the first is that the "file name" field contains garbage (NULL in the lpszFileName variable in CFileDialog Ctor didn't help)
2. Altough I delete my allocated buffer, I get "Out of memory" message box quite often (my allocation fails).
Download the sample application from this site:

The buffer size is defined by the member variable m_szBigBuffer in CustomFileDialog.h

Try it out.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.