
Trouble Getting multiple files using Common File Dialog
Quote:
>All,
>I am having difficulty retrieving all the filenames selected from the
common
>file open dialog. I believe that I have correctly initialized the pointer
>to a string buffer large enough and have set the ofn_allowmultiselect flag.
>I am having trouble using GetStartPosition and GetNextPathName in a loop
to
>retrieve all the filenames. Can anyone help with a little code snippet??
>Thanks,
>David
Here goes:
CString Filetypes;
Filetypes.LoadString(IDS_OPENFILETYPES);
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT, Filetypes, NULL);
char* buff=new char[65535];
buff[0]='\0';
dlg.m_ofn.lpstrFile=buff;
dlg.m_ofn.nMaxFile = 65535;//sizeof(buff);
POSITION Position;
if(dlg.DoModal()==IDOK)
Position=dlg.GetStartPosition();
while(Position)
{
//dlg.GetNextPathName(Position); will give you a path
}
}
delete [] buff;
cU
--
http://djuga.home.ml.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*NEW*: Retriever 1.1 is out: http://retriever.home.ml.org
Shareware image viewer, thumbnailer & database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~