Multiple file select in CFileDialog

I have a strange bug with using a subclass of CFileDialog to allow the user of my app to
select files.

I have a subclass called CFilePreDialog and basically the "standard" CFileDialog file browser pops
up and the user selects a JPEG file and then clicks "Open".  Works great.  Now, using the standard
windows feature, the user may "hold down CTRL and hilite multiple files" and then click "Open" and
all these files are selected.  This works great if the number of files is 2 or 3 or 4, but at some point
(may depend on file size? but not sure) it doesn't work.  Generally, if you try to hilite and select 8
or 10 files, it won't work.  The panel vanishes, and it acts exactly as if the user had pressed the
"cancel" button on the panel.

So what's up with this?  Why would the number of files selected matter?
tullheadAsked:
Who is Participating?
 
jimwassonCommented:
You need to be sure your buffer is large enough.

m_ofn.lpstrFile = stringbuffer
m_ofn.nMaxfile = length stringbuffer
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
buffer problem? (space to put the selected files into)
0
 
jimwassonCommented:
Oops. Sorry AndyAinscow -- I had an "old" page and didn't see your comment.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
AndyAinscowFreelance programmer / ConsultantCommented:
no probs.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
ps. thanks for apologies.
0
 
tullheadAuthor Commented:
jimwasson that was exactly what I needed, it has fixed it.  Thanks.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
tullhead - if you don't understand a comment then ask for further explanation.  The second comment by jimwasson apologised for making a duplicate of what I suggested was the problem.  That should have given you a strong hint that I deserved a thanks at least.  
0
 
tullheadAuthor Commented:
Thank you AndyAinscow - I should have thanked you before.  
But I suspected there was something too full, some buffer somewhere,
so your comment wasn't too helpful.  I gave the points to jimwasson
because he told me exactly where the problem was.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.