OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

TOpenSaveDialog with OFN_ALLOWMULTISELECT

Date: 08 Sep 2000
Time: 09:28:38
Remote Name: ???

Comments

Q. I am using the OFN_ALLOWMULTISELECT option of the TOpenSaveDialog class to be able to select  multiple files in an Open Dialog Box (BC++4.52). 
   It works for selecting up to 4 files, but when more files are selected, the program does nothing! 
   Can anybody tell how to select more files (say 50?)

A.  You have to allocate and assign a (large enough) memory block to TData::FileName. 
    Assign the length of this block to TData::MaxPath. 
    Don't forget to (first) delete the (default) memory block assigned to TData::FileName when this 
    structure is created;
Here's a code snippet:

  TOpenSaveDialog::TData  FileData;   //data structure for TFileOpenDialog
  delete [] FileData.FileName;
  FileData.FileName = new char[50*MAXPATH];  //MAXPATH is defined in a of BC++ header file
  *FileData.FileName = 0;
  FileData.MaxPath = 50 * MAXPATH;
  FileData.Flags = OFN_ALLOWMULTISELECT;
  TFileOpenDialog (parentWindow, FileData, 0, "A title")  OpenDialog;
  

Marvin Avery

Last changed: July 14, 2001