다음을 통해 공유


CFileDialog::UpdateOFNFromShellDialog

Updates the m_ofn data structure of the CFileDialog based on the current state of the internal object.

void UpdateOFNFromShellDialog();

Remarks

In versions of Windows before Windows Vista, the member OPENFILENAME data structure was continuously synchronized with the state of the CFileDialog. Any changes to the m_ofn member variable directly affected the state of the dialog box. Also, any changes to the state of the dialog immediately updated the m_ofn member variable.

In Windows Vista, the m_ofn data structure is not automatically updated. To guarantee the accuracy of the data in the m_ofn member variable, you should call the UpdateOFNFromShellDialog function before accessing the data. Windows calls this function automatically during the processing of IFileDialog::OnFileOK.

For more information about how to use the CFileDialog class under Windows Vista, see CFileDialog Class.

Example

This example updates the CFileDialog before displaying it. Before updating the m_ofn member variable, we need to synchronize it to the current state of the dialog box.

// Update the m_ofn variable
m_myFileDialogPtr->UpdateOFNFromShellDialog();

// Change the title
m_myFileDialogPtr->m_ofn.lpstrTitle = L"New Dialog Title";

// Apply the changes
m_myFileDialogPtr->ApplyOFNToShellDialog();

// Show the window
LRESULT result = m_myFileDialogPtr->DoModal();

Requirements

Minimum required operating system: Windows Vista

Header: afxdlgs.h

See Also

Reference

CFileDialog Class

Hierarchy Chart

CFileDialog::ApplyOFNToShellDialog