I want to be able to select mutliple files from a standard File Open dialog box, and be able to open all those files simultaneously.
How can this be done? Is there a specific flag that you can use in the CFileDialog class constructor?
This is how I've been doing it, but just for one file:
CFileDialog FileDlg(TRUE, _T("*.txt"), NULL, 0, _T("Text Files (*.txt)|*.txt|" ));
Thanks
3 4425
Read this. Especially, how to use OFN_ALLOWMULTISELECT.
Thanks, I finally got it to work, but now there is another problem.
If I select a small number of files, it works. If I select a larger number of files (+5), it exits the loop as if I had clicked "cancel" in the dialog box. - CFileDialog cfileDlg( TRUE, _T("*.cpf"), NULL, OFN_ALLOWMULTISELECT, _T("CPF Files (*.cpf)|*.cpf|" ));
-
-
CString csFileDlgTitle;
-
-
cfileDlg.m_ofn.lpstrTitle = csFileDlgTitle;
-
-
//int nRet = cfileDlg.DoModal( );
-
//ASSERT( ( nRet != IDOK ) || ( nRet != IDCANCEL ) );
-
-
if (cfileDlg.DoModal() != IDOK) {
-
return; //EXITS HERE IF I SELECT A LOT OF FILES, REGARDLESS OF WHAT I CLICK//
-
}
-
-
POSITION pos ( cfileDlg.GetStartPosition() );
-
-
while( pos )
-
{
-
CString csFileName( cfileDlg.GetNextPathName( pos ) );
-
-
FileOpenInput(csFileName);
The code that was commented out worked before, I took it out for other reasons.
I marked where the function terminates. That if statement is meant to be entered if the user clicks cancel in the File Open dialog box. What is the reason for this?
Thanks
So if DoModal() does not return IDOK, then what does it return??
I would have expected code like: -
if (cfileDlg.DoModal() == IDCANCEL)
-
{
-
switch(CommDlgExtendedError())
-
{
-
case: CDERR_FINDRESFAILURE
-
// etc...
-
break;
-
//etc...
-
}
-
//Then you get here on IDOK
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: yanivoliver |
last post by:
Hey,
I'm currently trying to find a way to open a dialog box that will allow
me to select more than one file at a time, so if I want to upload
select all the files in a directory, I won't have...
|
by: Johann Blake |
last post by:
I can hardly believe I'm the first one to report this, but having gone
through the newsgroup, it appears that way.
I would like to open a solution in the VS.NET IDE that consists of
multiple...
|
by: vinX |
last post by:
Ok, i am making a file renaming utility, you can add filesize (in MB o
KB), filepath, creation date and/or time, a counter, parent folder, th
original name etc...
I put the program in the...
|
by: Matt Hamilton |
last post by:
I have an application page with a datagrid with a checkbox on each row. The
user should check the rows they want to modify and then click a button. When
the button is clicked, I have a Click...
|
by: Stanav |
last post by:
Hello all,
Thanks in advance for any replies...
Now, my question is: Is it possible to do a multiple files download for a
single response event on an aspx page? If there is, please give me some...
| |
by: iwdu15 |
last post by:
how can i open a file i saved and place the info into different text boxes?
|
by: Pieter |
last post by:
Hi,
From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case...
|
by: kimiraikkonen |
last post by:
Hi,
I have an app which has a listbox and when i double click an
associated fileS, i want their paths to be added into listbox in my
application.
This code works good when i try to open a...
|
by: navanova |
last post by:
Greetings,
I have a problem of opening ms word and excel files on my computer. The files are there for a long time. I use to open and modify them. Suddenly, when i try to open the word files, a...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |