1

I don't want to display any overwrite prompt while user enter the file name which is already exist in my custom IFileDialog.

I have already gone throw IFileDialog::SetOptions method but it dint solve my problem.

FOS_OVERWRITEPROMPT (0x00000002) : When saving a file, prompt before overwriting an existing file of the same name. This is a default value for the Save dialog.

IS there any flag which help me out from this issue..?? Or is there any other way to prevent the overwrite prompt while saving the file.

Please help me. Many thanks in advance..:)

AB Bolim
  • 1,997
  • 2
  • 23
  • 47
  • It's not very clear what you did -- did you call `IFileDialog::SetOptions(0)` to reset the value? – Edward Clements Jun 09 '13 at 07:27
  • By default `IFileDialog` gives overwrite prompt, even `FOS_OVERWRITEPROMPT` flag is not set.. – AB Bolim Jun 09 '13 at 07:33
  • I haven't used `IFileDialog` myself, but [CFileDialog](http://msdn.microsoft.com/en-us/library/wh5hz49d(v=vs.100).aspx) works with `dwFlags` set to `OFN_HIDEREADONLY` – Edward Clements Jun 09 '13 at 07:51
  • `CFileDialog` does not work in Win7, I mean `OnInitDialog()` method of `CFileDialog` does not call in Win7, So that I am using `IFileDialog`. Is there any flag in `IFileDialog` ??? – AB Bolim Jun 09 '13 at 11:06
  • The [documentation for CFileDialog](http://msdn.microsoft.com/en-us/library/dk77e5e7(v=vs.100).aspx) says `OnInitDialog` inherited function is not supported under Windows Vista (or later) -- do you do anything special in `OnInitDialog()`? – Edward Clements Jun 09 '13 at 16:00

1 Answers1

0
    HRESULT hr;
    DWORD dwFlags = 0;

//pDlg is your IFileSaveDialog
    hr = pDlg->GetOptions ( &dwFlags );
    if( dwFlags & FOS_OVERWRITEPROMPT )
    {
        dwFlags = dwFlags & ( ~FOS_OVERWRITEPROMPT);
        hr = pDlg->SetOptions ( dwFlags );
    }
CreativeMind
  • 897
  • 6
  • 19