How do I hide a particular control in File-open dialog? (A dialog created using CFileDialog)
Below is the code which I used to create a File-Open Dialog. This works fine, no problem in the code but for some reason i wish to hide the change your view control (I have highlighted that in the attachment)
CString strFilter = _T(".mp3"); CFileDialog fileDialog(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY | OFN_LONGNAMES, strFilter, NULL, 0, TRUE); CString szStrTitle = _T("Select the file"); fileDialog.m_ofn.lpstrTitle = szStrTitle; TCHAR *filenameBuffer = new TCHAR[4000 * 1000]; filenameBuffer = 0; fileDialog.m_ofn.lpstrFile = filenameBuffer; fileDialog.m_ofn.nMaxFile = 4000 * 1000; fileDialog.DoModal();
Nowadays, the proper way of customizing common file dialog is to use
IFileDialogCustomize. This interface is fully documented at https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nn-shobjidl_core-ifiledialogcustomize
For your specific case you'll need to use
You can also use
IFileDialogCustomize::SetControlItemState()which allows you to hide the target control.