Click here to Skip to main content
15,919,422 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCFileDialog - Open Dialog Pin
murali_utr6-Jan-04 20:21
murali_utr6-Jan-04 20:21 
GeneralRe: CFileDialog - Open Dialog Pin
BaldwinMartin6-Jan-04 21:08
BaldwinMartin6-Jan-04 21:08 
Hi Alway use CommDlgExtendedError to figure out what is wrong with common dialogs.

Next Use
static char BASED_CODE szFilter[] = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||";

static char BASED_CODE szFilter[] = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*||";
CFileDialog fileDialog(true, NULL, NULL,
(OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES | OFN_PATHMUSTEXIST),
szFilter);

fileDialog.m_ofn.lpstrTitle = _T("Choose Files");
//fileDialog.m_ofn.lpTemplateName = "Open";

// need larger filename buffer to support multiselect
TCHAR filenameBuffer[4096] = { 0 } ;
fileDialog.m_ofn.lpstrFile = filenameBuffer;
fileDialog.m_ofn.nMaxFile = sizeof(filenameBuffer) / sizeof(filenameBuffer[0]);

if (IDOK == fileDialog.DoModal())
{
POSITION pos = fileDialog.GetStartPosition();
while (pos != NULL)
{
CString filename = fileDialog.GetNextPathName(pos);
AfxMessageBox(filename);
}
AfxMessageBox("Set Modified Flag");

}
else
{
DWORD errCode = CommDlgExtendedError();
switch (errCode)
{
case 0:
TRACE(_T("User cancelled Extract dialog\n"));
break;
// case FNERR_BUFFERTOOSMALL: // define if needed like #define FNERR_BUFFERTOOSMALL 0x000100
// ::AfxMessageBox(_T("Too many files selected. Try again with fewer files."));
// break;
default:
::AfxMessageBox(_T("An error occurred"));
break;
}
}



Best Wishes and Happy Holiday's,
ez_way
GeneralRe: CFileDialog - Open Dialog Pin
shultas7-Jan-04 2:14
shultas7-Jan-04 2:14 
GeneralThanks Pin
murali_utr7-Jan-04 16:04
murali_utr7-Jan-04 16:04 
GeneralCompiling problem.. Pin
KellyR6-Jan-04 17:55
KellyR6-Jan-04 17:55 
GeneralRe: Compiling problem.. Pin
KellyR6-Jan-04 18:01
KellyR6-Jan-04 18:01 
GeneralCListCtrl and Printing Pin
Sitaram Sukumar6-Jan-04 17:37
Sitaram Sukumar6-Jan-04 17:37 
GeneralRe: CListCtrl and Printing Pin
sunil samineni6-Jan-04 18:53
sunil samineni6-Jan-04 18:53 
GeneralRe: CListCtrl and Printing Pin
Selvam R6-Jan-04 19:13
professionalSelvam R6-Jan-04 19:13 
Generala question about createprocess Pin
cchere6-Jan-04 17:36
cchere6-Jan-04 17:36 
GeneralRe: a question about createprocess Pin
Selvam R6-Jan-04 19:19
professionalSelvam R6-Jan-04 19:19 
GeneralRe: a question about createprocess Pin
Anonymous7-Jan-04 6:19
Anonymous7-Jan-04 6:19 
GeneralRe: a question about createprocess Pin
David Crow7-Jan-04 6:44
David Crow7-Jan-04 6:44 
GeneralRe: a question about createprocess Pin
cchere7-Jan-04 9:41
cchere7-Jan-04 9:41 
GeneralRe: a question about createprocess Pin
David Crow7-Jan-04 9:45
David Crow7-Jan-04 9:45 
GeneralRe: a question about createprocess Pin
cchere7-Jan-04 10:36
cchere7-Jan-04 10:36 
GeneralRe: a question about createprocess Pin
David Crow7-Jan-04 2:54
David Crow7-Jan-04 2:54 
GeneralRe: a question about createprocess Pin
Anonymous7-Jan-04 6:10
Anonymous7-Jan-04 6:10 
GeneralPrinting Bitmaps Pin
GESY6-Jan-04 15:44
GESY6-Jan-04 15:44 
GeneralCan't import my dll functions Pin
benwestgarth6-Jan-04 15:33
benwestgarth6-Jan-04 15:33 
GeneralRe: Can't import my dll functions Pin
Anonymous6-Jan-04 15:54
Anonymous6-Jan-04 15:54 
GeneralCustom Timeline Pin
rotu6-Jan-04 14:34
rotu6-Jan-04 14:34 
GeneralChanging source url for web service Pin
Boris Russel6-Jan-04 12:58
Boris Russel6-Jan-04 12:58 
GeneralNevermind <slap self> Pin
Boris Russel6-Jan-04 13:12
Boris Russel6-Jan-04 13:12 
GeneralMinimizing window Pin
Anonymous6-Jan-04 12:16
Anonymous6-Jan-04 12:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.