Solved

Multiple file select in CFileDialog

Posted on 2004-08-20
8
383 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:tullhead
  • 4
  • 2
  • 2
8 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11855107
buffer problem? (space to put the selected files into)
0
 
LVL 7

Accepted Solution

by:
jimwasson earned 250 total points
ID: 11855216
You need to be sure your buffer is large enough.

m_ofn.lpstrFile = stringbuffer
m_ofn.nMaxfile = length stringbuffer
0
 
LVL 7

Expert Comment

by:jimwasson
ID: 11855224
Oops. Sorry AndyAinscow -- I had an "old" page and didn't see your comment.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11855684
no probs.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11855695
ps. thanks for apologies.
0
 

Author Comment

by:tullhead
ID: 11857736
jimwasson that was exactly what I needed, it has fixed it.  Thanks.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11868483
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
 

Author Comment

by:tullhead
ID: 11872212
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

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 125
Add content to output file 4 63
notReplace  challenge 53 125
sum13 challenge 24 105
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now