Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


MFC70, CFileDialog and WinNT

Posted on 2003-03-10
Medium Priority
Last Modified: 2013-11-20
I have an app made in VC++.NET and MFC. It works fine in WinXP and Win2000, but in Win9X and WinNT CFileDialogs does not show. According to information on CFileDialog is changed in MFC 7.0 to use the new File Open and Save dialog boxes in Win2000 and WinXP. Obviously these new dialog boxes does not work in older Windows versions, but why don't I get the old dialog boxes instead? Does anyone have a solution how to get this working also in Win9X and WinNT?
Question by:P1R
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 30

Expert Comment

ID: 8103832
How is the CFileDialog instance created? Are you using static or shared MFC DLL's?

Accepted Solution

hoabeo earned 400 total points
ID: 8108444
This is a bug on MFC implementation. The bug happened when compiling project under Win2000/XP and running it under win9x, because of wrong size passed to OPENFILENAME struct when creating instance of CFileDialog (a fixed value will be assigned when compiled).

explicit CFileDialog(
   BOOL bOpenFileDialog,
   LPCTSTR lpszDefExt = NULL,
   LPCTSTR lpszFileName = NULL,
   LPCTSTR lpszFilter = NULL,
   CWnd* pParentWnd = NULL,
   DWORD dwSize = sizeof(

if you change dwSize param to 0, CFileDialog will dynamically assigns the size of OPENFILENAME according to the current system.

The use of CFileDialog will be:
CFileDialog fileDlg (TRUE, "my", "*.my",
// Display the file dialog.
if( fileDlg.DoModal ()==IDOK )
   CString pathName = fileDlg.GetPathName();
  // Implement opening and reading file in here.

Author Comment

ID: 8117809
Great, thanks!

(Isn't it amazing that a zero in the right place so often makes all the difference:)

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question