CFileDialog has empty view dropdown
The C++/MFC File Open dialog (CFileDialog) produces incorrect results on Windows 10. Namely, the View Menu dropdown (blud arrow) is empty. The same executable, run on Windows 7, produces the expected View Menu (red box). Another difference is the navigation pane on the left. The navigation pane difference is unimportant; I just showed it for completeness.
The C++ code producing this image is CFileDialog dlg(TRUE); dlg.DoModal();
This code is in a large project which has been ported successively from Visual C++ 6 (ca 1982). The same code in a new test project shows a normal Windows 10 File Open dialog, with the new-style view menu. So probably the failure is due to some setting in the large project.
The large project is built with MFC linked as a static library, using ANSI (not Unicode). All the libraries are from the current Windows 10 kit (10.0.18362.0); this is VS 2019 16.10.4. Both debug and release builds behave the same way, and the problem has existed for several years.
For large project, using the debugger to step thru the CFileDialog constructor shows that the call to CoCreateInstance
returns CLASS_E_CLASSNOTAVAILABLE ClassFactory cannot supply requested class
. In the new test project, this function does not return an error.
Both large project and test project have the same project properties.
The same symptom occurs on a different Windows 10 installation.
How can I fix the issue of the empty View Menu?