title: MFC: how to differentiate "Save" vs "Save As"?
body: <p>In my previous question (<a href="https://stackoverflow.com/questions/61919613/mfc-how-to-change-default-file-name-for-cfiledialog">MFC: how to change default file name for CFileDialog?</a>), I overload <code>DoSave</code> function to supply a file name suggestion. Within this function is there way to differentiate "Save" vs "Save As"? Because I should only pop out dialog window if it is "Save As".</p>
  
  <pre><code>BOOL CMyDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
  {
      if (IsSaveAS() || m_saved_file_name.IsEmpty())
      {
          CString file_name = some_suggested_file_name;
  
          CFileDialog file_dialog(false, ..., file_name, ...);
  
          if (file_dialog.DoModal() == IDOK)
          {
              m_saved_file_name = file_dialog.GetPathName();
          }
      }
  
      OnSaveDocument(m_saved_file_name);
  
      return TRUE;
  }
  </code></pre>