如何用自己设计的open或save对话框?如何在vc6中用word2000式的open和save对话框?

解决方案 »

  1.   

    void MM Doc::OnFileSaveAs() 
    {
    // TODO: Add your command handler code here
    BeginWaitCursor();
    static char BASED_CODE szSaveFilter[] = 
    "数据文件(*.rev)|*.rev|文本文件(*.txt)|*.txt|||";
    CFileDialog FileDlg(FALSE, "rev", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szSaveFilter);
    if (FileDlg.DoModal() == IDOK)
    {
    UpdateAllViews(NULL);
    SetModifiedFlag(FALSE);
    lpszName=FileDlg.m_ofn.lpstrFile;
    OnSaveDocument(lpszName);
    SetPathName(lpszName,TRUE);
    m_nFileSty=FileDlg.m_ofn.nFilterIndex;
    }
    EndWaitCursor();
    }
    void MMDoc::OnFileOpen() 
    {
    // TODO: Add your command handler code here static char BASED_CODE szOpenFilter[] = 
    "数据文件(*.rev)|*.rev|文本文件(*.txt)|*.txt|其他数据文件(*.dat;*.raw)|*.dat;*.raw|所有文件(*.*)|*.*||";
    CFileDialog FileDlg(TRUE, "*.txt", NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST|OFN_ENABLESIZING, szOpenFilter); if (FileDlg.DoModal() != IDOK) return;  m_nFileSty=FileDlg.m_ofn.nFilterIndex;
    lpszName=FileDlg.m_ofn.lpstrFile;
    OnOpenDocument(lpszName);
    SetPathName(lpszName,TRUE);
    }
      

  2.   

    Overloaded the Open File Common Dialog!
      

  3.   

    OPENFILENAME ofn;
    static char szFile[255]="";
    static char szFileTitle[255];memset(&ofn,0,sizeof(ofn));
    ofn.lStructSize=sizeof(ofn);
    ofn.hwndOwner=GetSafeHwnd();
    ofn.lpstrFilter="日志文件\0*.log\0\0";
    ofn.nFilterIndex=0;
    ofn.lpstrFile=szFile;
    ofn.nMaxFile=sizeof(szFile);
    ofn.lpstrFileTitle=szFileTitle;
    ofn.nMaxFileTitle=sizeof(szFileTitle);
    ofn.Flags=OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT;GetOpenFileName(&ofn)
      

  4.   

    我记得vc++6.0技术内幕里面有介绍的,是在对话框里面内嵌CFileDialog对话框
      

  5.   

    see this.
    http://www.codeproject.com/dialog/customize_dialog.asp
    http://www.codeproject.com/dialog/selectfolder.asp
      

  6.   

    salt_ice(阿拉)  cuizm(射天狼)
    你们说的都不通用对话框吗??
      

  7.   

    win2000式样的对话框怎样在vc6中生成?
      

  8.   

    OPENFILENAME ofn;
    static char szFile[255]="";
    static char szFileTitle[255];memset(&ofn,0,sizeof(ofn));
    ofn.lStructSize=sizeof(ofn);
    ofn.hwndOwner=GetSafeHwnd();
    ofn.lpstrFilter="日志文件\0*.log\0\0";
    ofn.nFilterIndex=0;
    ofn.lpstrFile=szFile;
    ofn.nMaxFile=sizeof(szFile);
    ofn.lpstrFileTitle=szFileTitle;
    ofn.nMaxFileTitle=sizeof(szFileTitle);
    ofn.Flags=OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT;GetOpenFileName(&ofn);在Flags标志中加入OFN_EXPLORER就能生成win2000样式的对话框,你试一下吧~~
      

  9.   

    即使不加入OFN_ECPLORER也能生成win2000式样的对话框,why??
      

  10.   

    因为它调用的系统的API函数,其实不要Flags这一行都行的
    如果直接调用API函数,在98下是98的样式,在2000下是2000的样式