May 6th, 2010, 02:31 PM
CFileDialog hides files when file filter drop-list changes
I am using the CFileDialog code below to open a file. When the dialog first opens, I see all of the .xml files in my directory. If I change the filter to all files, every file disappears from the explorer window. Changing back to .xml does not bring the files back. If I go up one directory and then go back into my folder, the files will show up again. I am using vs2008, and this code has been working for a while on winXP. The problem started when I switched to Win7 OS. I do not see the problem when running the exe on any cpu w/ Win7 installed, but any cpu running WinXP has this problem. I have searched message boards online and have not really found anything helpful. I am wondering if I need to be calling UpdateOFNFromShellDialog(); when the filter is changed, but it seems odd to me that I would have to create a custom class to get this basic functionality to work. I have tried setting the bVistaStyle flag to FALSE but that did not work.
Thanks in advance for the help.
static CFileDialog OpenFileDlg(
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_DONTADDTORECENT,
"XML Files (*.xml)|*.xml|All Files (*.*)|*.*||",
OpenFileDlg.m_pOFN->lpstrInitialDir = m_RootDirectory.c_str();
if( OpenFileDlg.DoModal() != IDCANCEL )
Open( OpenFileDlg.GetPathName() );
Tags for this Thread
Click Here to Expand Forum to Full Width