VC++不会.我想实现打开文件操作,就像播放器打开某个文件一样.请高手指教..给分的哦

解决方案 »

  1.   

    CFileDialog dlg;
    dlg.DoModal();
      

  2.   

    char szFileters[]="Excel Files(*.xls)|*.xls||";//打开对话框中文件类型
    CFileDialog dlg(true,NULL,NULL,OFN_HIDEREADONLY,szFileters);
    if(dlg.DoModal()==IDOK)
    this->m_strPath=dlg.GetPathName();//保存选择的文件的路径
    UpdateData(false);
      

  3.   

    选 SingleDocument 模式 ,菜单上面有现成的 打开 功能.
      

  4.   

    CFileDialog dlg();
    CString strFilePath;
    if(dlg.DoModal()==IDOK)
    strFilePath=dlg.GetPathName();
      

  5.   

    晕,这么简单的问题
    CFileDialog filedlg(FALSE);
    filedlg.DoModal();
      

  6.   

    char m_fileName[256];
    CFileDialog fdlg(TRUE,NULL, NULL, OFN_HIDEREADONLY| OFN_OVERWRITEPROMPT,
    "DBS files (*.dbs)|*.DBS|View files(*.view)|*.VIEW|all files (*.*)|*.*||" , NULL);
    if( fdlg.DoModal()==IDOK )
    {
    strcpy( m_fileName, (char*)(LPCTSTR)(fdlg.GetPathName()) ); // 获得文件名
    m_fhd = fopen(m_fileName,"r+b"); // 打开文件
              }
      

  7.   

    为什么我加上以上代码后编译出错.
    MainFrm.cpp
    D:\book\hello\MainFrm.cpp(267) : error C2228: left of '.DoModal' must have class/struct/union type
    D:\book\hello\MainFrm.cpp(268) : warning C4390: ';' : empty controlled statement found; is this the intent?
    D:\book\hello\MainFrm.cpp(268) : error C2228: left of '.GetPathName' must have class/struct/union type
    Generating Code...
    Error executing cl.exe.hello.exe - 2 error(s), 1 warning(s)