CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    File Dialog - Why can I change caption on "Open" button but not "Save" button?

    I created a subclass of CFileDialog that takes a dialog caption and a caption for the "Open" or "Save" button in addition to the usual parameters to the constructor. This works fine for an open file dialog, but when I use it with a save file dialog, the caption on the "Save" button does not change. Why? The code is as follows:

    CMyFileDialog::CMyFileDialog(BOOL bOpenFileDialog, LPCTSTR lpszDefExt,
    LPCTSTR lpszFileName, DWORD dwFlags,
    LPCTSTR lpszFilter, CWnd* pParentWnd,
    const char* strTitle, const char* strBtnCaption
    ) :
    CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter,
    pParentWnd
    )
    {
    m_csTitle = strTitle;
    m_ofn.lpstrTitle = m_csTitle;
    m_csBtnCaption = strBtnCaption;
    }

    BOOL CMyFileDialog::OnInitDialog()
    {
    CFileDialog::OnInitDialog();

    GetParent()->SetDlgItemText(IDOK, m_csBtnCaption);

    return TRUE;
    }



  2. #2
    Join Date
    May 1999
    Location
    CA, USA
    Posts
    586

    Re: File Dialog - Why can I change caption on "Open" button but not "Save" button?

    Hmm... it should work the same for Save As and for Open, but you could also use the undocumented function SetControlText()... to see how it can be used, check out Example 11 on my web site at
    http://home.earthlink.net/~railro/mfc_link.html

    Recording Engineer/Software Developer
    Rail Jon Rogut Software
    [email protected]
    http://home.earthlink.net/~railro/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured