Displaying XP Style CFileDialog in Windows 7

CFileDialog is an MFC class that gives interface to the “browse” windows for opening and saving a file or files. In Windows 7 you can see that there are significant differences in the appearance of the same compared to Windows XP. It is since the Windows Vista this change happened. Nice and neat of-course.

Default CFileDialog in Windows 7


CFileDialog as in Windows XP

I’m perfectly OK with the CFileDialog as in Win7, but my client wasn’t. I asked many of my gurus and couldn’t find a way out, but the very simple solution for this, I got as an answer to my stack overflow question. In the CFileDialog constructor, the last parameter, bVistaStyle will be TRUE by default. We will have to make it FALSE and you will get an Open/Save Dialog just like the first image. You can also remove the places bar and make it simple by setting OFN_EX_NOPLACESBAR to m_ofn.FlagsEx before DoModal-ing the dialog.

Advertisement

About The Half-Blood Geek

A GOD loving, enthusiastic, day dreaming, innovative, perfectionist. A software engineer by proffession, guitarist by passion and blogger by pastime.

Posted on July 29, 2011, in C++, Technical, Tip and tagged , , , , , . Bookmark the permalink. Leave a Comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 216 other followers