help
-
Can anybody help me in solving my problem..... i am using a CFileDialog class for accessing multiple files through browse.But depending up on the file path length the number of files that are getting selected varied Is there anyway in solving this problem(i need to select a maximum of 20 files). CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK |OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*");:doh:
||SnAkeBed||
-
Can anybody help me in solving my problem..... i am using a CFileDialog class for accessing multiple files through browse.But depending up on the file path length the number of files that are getting selected varied Is there anyway in solving this problem(i need to select a maximum of 20 files). CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK |OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*");:doh:
||SnAkeBed||
I htink you need to change the buffer size used for the returned filenames if the OFM struct: It has to be large enough to contain all the full paths etc for all the files selected. So you probably need _MAX_PATH * 20 in length:
// copied and pasted from an app char buffer[4096] = ""; // filename(s) buffer dlg.m_ofn.nMaxFile = 4096; dlg.m_ofn.lpstrFile = buffer;
If you vote me down, my score will only get lower
-
Can anybody help me in solving my problem..... i am using a CFileDialog class for accessing multiple files through browse.But depending up on the file path length the number of files that are getting selected varied Is there anyway in solving this problem(i need to select a maximum of 20 files). CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK |OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*");:doh:
||SnAkeBed||
i tried that its generating error... this is my exact code obBrowse() { int count=0; CSting filename[256]; CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK|OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*"); POSITION file=fileDialog.GetStartPosition(); if(fileDialog.DoModal==IDOK) //this is where error is generating if i select more files... (for example 20) { UINT count=0; POSITION pos=fileDialog.GetStartPosition(); while(pos) { fileDialog.GetNextPathPosition(pos); ++count; } while(file!=NULL) { fileName[count]=fileDialog.GetNextPathName(file); } } } can you tell me where
||SnAkeBed||
-
Can anybody help me in solving my problem..... i am using a CFileDialog class for accessing multiple files through browse.But depending up on the file path length the number of files that are getting selected varied Is there anyway in solving this problem(i need to select a maximum of 20 files). CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK |OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*");:doh:
||SnAkeBed||
I use this code:
CFileDialog dlgFile(TRUE, "txt", NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT, YOURFILETYPEFILTER, NULL, 0); CString ResourceString="Select file(s)"; TCHAR szFile[IMPORT_MAX_PATH_LENGTH]; _tcscpy(szFile, ResourceString); dlgFile.m_ofn.lpstrFile=szFile; dlgFile.m_ofn.nMaxFile=IMPORT_MAX_PATH_LENGTH; if(dlgFile.DoModal()!=IDOK) return FALSE;
Russell
-
i tried that its generating error... this is my exact code obBrowse() { int count=0; CSting filename[256]; CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK|OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*"); POSITION file=fileDialog.GetStartPosition(); if(fileDialog.DoModal==IDOK) //this is where error is generating if i select more files... (for example 20) { UINT count=0; POSITION pos=fileDialog.GetStartPosition(); while(pos) { fileDialog.GetNextPathPosition(pos); ++count; } while(file!=NULL) { fileName[count]=fileDialog.GetNextPathName(file); } } } can you tell me where
||SnAkeBed||
SnaKeBeD wrote:
if(fileDialog.DoModal==IDOK)
How did you even get this to compile correctly, or is it not a true copy/paste?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
i tried that its generating error... this is my exact code obBrowse() { int count=0; CSting filename[256]; CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK|OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*"); POSITION file=fileDialog.GetStartPosition(); if(fileDialog.DoModal==IDOK) //this is where error is generating if i select more files... (for example 20) { UINT count=0; POSITION pos=fileDialog.GetStartPosition(); while(pos) { fileDialog.GetNextPathPosition(pos); ++count; } while(file!=NULL) { fileName[count]=fileDialog.GetNextPathName(file); } } } can you tell me where
||SnAkeBed||
SnaKeBeD wrote:
CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK|OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*"); POSITION file=fileDialog.GetStartPosition();
mmmm...is it too soon to call
GetStartPosition()
?:~
Russell
-
i tried that its generating error... this is my exact code obBrowse() { int count=0; CSting filename[256]; CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK|OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*"); POSITION file=fileDialog.GetStartPosition(); if(fileDialog.DoModal==IDOK) //this is where error is generating if i select more files... (for example 20) { UINT count=0; POSITION pos=fileDialog.GetStartPosition(); while(pos) { fileDialog.GetNextPathPosition(pos); ++count; } while(file!=NULL) { fileName[count]=fileDialog.GetNextPathName(file); } } } can you tell me where
||SnAkeBed||
-
I use this code:
CFileDialog dlgFile(TRUE, "txt", NULL, OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_ALLOWMULTISELECT, YOURFILETYPEFILTER, NULL, 0); CString ResourceString="Select file(s)"; TCHAR szFile[IMPORT_MAX_PATH_LENGTH]; _tcscpy(szFile, ResourceString); dlgFile.m_ofn.lpstrFile=szFile; dlgFile.m_ofn.nMaxFile=IMPORT_MAX_PATH_LENGTH; if(dlgFile.DoModal()!=IDOK) return FALSE;
Russell
_Russell_ wrote:
CString ResourceString="Select file(s)"; TCHAR szFile[IMPORT_MAX_PATH_LENGTH]; _tcscpy(szFile, ResourceString);
you could have factorized this anyway :
TCHAR szFile[IMPORT_MAX_PATH_LENGTH] = _T("Select file(s)");
;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
_Russell_ wrote:
CString ResourceString="Select file(s)"; TCHAR szFile[IMPORT_MAX_PATH_LENGTH]; _tcscpy(szFile, ResourceString);
you could have factorized this anyway :
TCHAR szFile[IMPORT_MAX_PATH_LENGTH] = _T("Select file(s)");
;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
Can anybody help me in solving my problem..... i am using a CFileDialog class for accessing multiple files through browse.But depending up on the file path length the number of files that are getting selected varied Is there anyway in solving this problem(i need to select a maximum of 20 files). CFileDialog fileDialog(true,null,null,OFN_MULTISELECT | OFN_NODEREFERNCELINK |OFN_EXPLORER ,"Excel File(*.xls)|*.xls|AllTypes(*.*)|*.*");:doh:
||SnAkeBed||