问题描述
voidCVCDDlg::OnOpenButton(){charszFilter[]="AVIFile(*.avi)|(*.avi)|MovieFile(*.mov)|(*.mov)|MediaFile(*.mmm)|(*.mmm)|MPEGFile(*.mpeg)|(*.mpeg)|AllFile(*.*)|*.*||";/CFileDialogFileDlg(TRUE,NULL,,NULL,OFN_HIDEREADONLY,szFilter);if(FileDlg.DoModal()==IDOK){CStringPathName=FileDlg.GetPathName();PathName.MakeUpper();m_ActiveMovie.SetFileName(PathName);}}以下是调试结果,很不懂,,,请各位指教--Configuration:VCD-Win32Debug--------------------Compiling...VCDDlg.cppC:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(175):errorC2001:newlineinconstantC:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(176):errorC2146:syntaxerror:missing';'beforeidentifier'AVI'C:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(176):errorC2065:'AVI':undeclaredidentifierC:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(176):errorC2146:syntaxerror:missing';'beforeidentifier'File'C:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(176):errorC2065:'File':undeclaredidentifierC:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(176):errorC2059:syntaxerror:'.'C:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(180):errorC2001:newlineinconstantC:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(183):errorC2065:'FileDlg':undeclaredidentifierC:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(183):errorC2228:leftof'.DoModal'musthaveclass/struct/uniontypeC:ProgramFilesMicrosoftVisualStudioMyProjectsVCDVCDDlg.cpp(185):errorC2228:leftof'.GetPathName'musthaveclass/struct/uniontypeErrorexecutingcl.exe.VCD.exe-10error(s),0warning(s)
解决方案
解决方案二:
/CFileDialogFileDlg(TRUE,NULL,,NULL,OFN_HIDEREADONLY,szFilter);这句前“/”这不能有,可以用CString来代替那个字符数组。那样赋值是不行的吧
解决方案三:
CFileDialogFileDlg前面的反斜杠"/"是多出来的.
解决方案四:
看我常用的:CFileDialogaDlg(true);aDlg.m_ofn.lpstrTitle=_T("打开文件");//aDlg.m_ofn.lpstrInitialDir=_T("D:\");aDlg.m_ofn.lpstrFilter=_T("*.txt*.txt*.**.*");if(aDlg.DoModal()==IDOK){CStringSFileName,SPathFileName;SFileName=aDlg.GetFileNameSPathFileName=aDlg.GetPathName();}关键:aDlg.m_ofn.lpstrFilter=_T("*.txt*.txt("*.mp3*.mp3*.**.*");
解决方案五:
修正:aDlg.m_ofn.lpstrFilter=_T("*.txt*.txt*.mp3*.mp3*.**.*");
解决方案六:
修正:aDlg.m_ofn.lpstrFilter=_T("*.txt*.txt*.mp3*.mp3*.**.*");
解决方案七:
该回复于2011-12-12 11:39:15被版主删除
解决方案八:
应该转义下字符..