RanBN
asked on
multi-select for CFileDialog
hi all,
the CFileDialog probably has a limitation of the qountity of files it can choose in one iteration of multi-select. when it exceeds the num of files it can choose, the DoModal returns IDCANCEL, and I have no way of knowing why it failed.
my question is how can I tell after the DoModal() failed that it is due to the num of files that were picked, and not because user simply clicked "Cancel"?
10x, RanBN
the CFileDialog probably has a limitation of the qountity of files it can choose in one iteration of multi-select. when it exceeds the num of files it can choose, the DoModal returns IDCANCEL, and I have no way of knowing why it failed.
my question is how can I tell after the DoModal() failed that it is due to the num of files that were picked, and not because user simply clicked "Cancel"?
10x, RanBN
Call the ::CommDlgExtendedError function.
If you follow Chensu's comment you will get the error : FNERR_BUFFERTOOSMALL
This is because CFileDialog set the buffer which stores the file names(lpstrFile member of OPENFILENAME struct) to 260 chars.
You can derive a class from CFileDialog and set the buffer size to what you want.
Vicky
This is because CFileDialog set the buffer which stores the file names(lpstrFile member of OPENFILENAME struct) to 260 chars.
You can derive a class from CFileDialog and set the buffer size to what you want.
Vicky
ASKER
10x both,
Can you give an example? I tried playing with it, allocating memory, defining the nMaxFile field, and I managed to pick multy files. but still I have 2 problems:
1. the first is that the "file name" field contains garbage (NULL in the lpszFileName variable in CFileDialog Ctor didn't help)
2. Altough I delete my allocated buffer, I get "Out of memory" message box quite often (my allocation fails).
10x,
RanBN
Can you give an example? I tried playing with it, allocating memory, defining the nMaxFile field, and I managed to pick multy files. but still I have 2 problems:
1. the first is that the "file name" field contains garbage (NULL in the lpszFileName variable in CFileDialog Ctor didn't help)
2. Altough I delete my allocated buffer, I get "Out of memory" message box quite often (my allocation fails).
10x,
RanBN
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER