I recently converted my MFC code from VS2003 to VS2005. I have a custom file open save dialog (CCustomFileDialog) and I enable the template resouce as shown in code below. The custom dialog show up OK but if I do CtrlC to copy a file or delete a file from within the dialog and then cancel out from the dialog, it closes OK but it errors out (CDERR_FINDRESFAILURE in CFileDialog::DoModal) when I try to open the custom dialog again.
If I open the dialog and selct file, open it or cancel out without doing (copy, delete etc), I am able to open the custom dialog again and again without any problems. I have attached the relevant code below. I would really appreciate if somebody could please point out what the problem could be.
This happens only on some of customer computers not on development computer.
It worked fine on same customer's computer when the code was in VS2003.
m_ofn.Flags |= (OFN_ENABLETEMPLATE);
m_ofn.lpTemplateName = MAKEINTRESOURCE (IDD_FILE_OPENSAVE); // IDD_FILE_OPENSAVE is custom file open save dialog
m_ofn.hInstance = AfxGetResourceHandle();
CCustomFileDialog *pDlg = NULL;
pDlg = new CFileDialogSC(...);
if (pDlg->DoModal()== IDOK)
sprintf(buffer, "DoModal Failled Error %d", CommDlgExtendedError());
MessageBox(NULL, buffer, "", MB_OK);