IFileDialogEvents::OnFileOk method (shobjidl_core.h)

Called just before the dialog is about to return with a result.

Syntax

HRESULT OnFileOk(
  [in] IFileDialog *pfd
);

Parameters

[in] pfd

Type: IFileDialog*

A pointer to the interface that represents the dialog.

Return value

Type: HRESULT

Implementations should return S_OK to accept the current result in the dialog or S_FALSE to refuse it. In the case of S_FALSE, the dialog should remain open.

Remarks

When this method is called, the IFileDialog::GetResult and GetResults methods can be called.

The application can use this callback method to perform additional validation before the dialog closes, or to prevent the dialog from closing. If the application prevents the dialog from closing, it should display a UI to indicate a cause. To obtain a parent HWND for the UI, obtain the IOleWindow interface through IFileDialog::QueryInterface and call IOleWindow::GetWindow.

An application can also use this method to perform all of its work surrounding the opening or saving of files.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)