Solved

Multiple file select in CFileDialog

Posted on 2004-08-20
8
382 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
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11855684
no probs.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

14 Experts available now in Live!

Get 1:1 Help Now