Click here to Skip to main content
13,350,861 members (63,165 online)
Click here to Skip to main content
Add your own
alternative version


30 bookmarked
Posted 13 Jun 2003

XFileProperties - A modeless dialog to display file properties

, 13 Jun 2003
Rate this:
Please Sign up or sign in to vote.
XFileProperties demonstrates the use of CXFileProperties, a class that displays a modeless dialog similar to the Windows file properties dialog.


One day my Product Manager asked me to add version information display to our program suite. He asked me how long it would take, and since I knew the trick for displaying the Windows properties dialog, I told him it would take two days. Big mistake! I forgot that he almost never likes first thing I show him. So, next day, I showed him this:

XFileProperties screenshot

And naturally he did not like it. He was concerned that users may click on Advanced button and change something, which would cause us support problems. OK, that is not unreasonable. So I toldl him that we would need to reverse engineer functionality and create a dialog without user interaction buttons. He asked me how long it would take, and since I knew there were classes available to get version information, I told him it would take four days. Big mistake! I find out that classes available are good if you know version strings in advance (like Product Name, etc.), but not so good if you need to populate two listboxes like in properties dialog. Since some of our apps are actually provided by third-party vendors, we have no control over what version string names they use. I also discovered that at least one vendor has an exe with a custom-generated version resource which seemed to defy all classes I tested it with.

OK, now is time to get serious. After looking through hex dumps of version data, I figured out the structure and how to populate controls, and make dialog look pretty close to Windows properties dialog. Here is test app, which allows you to compare Windows dialog and XFileProperties dialog (both are modeless, and will allow multiple copies of dialog, as long as selected file is different):

XFileProperties screenshot

Clicking on Windows Properties button will display dialog you see above. Clicking on XFileProperties button will display this dialog:

XFileProperties screenshot

The version tab:

XFileProperties screenshot

How to use

To integrate CXFileProperties into your app, you first need to add following files to your project:

  • Version.cpp
  • Version.h
  • XFileProperties.cpp
  • XFileProperties.h
  • XFileProperties.rc
  • XFilePropertiesRes.h
  • XSplitpath.h

Next, include XFileProperties.h in appropriate project files, and include XFileProperties.rc and XFilePropertiesRes.h in your project's rc file. You can do this by going to View | Resource Includes and entering the files as shown below:

XFileProperties screenshot

Now you are ready to start using CXFileProperties. Here is code that invokes CXFileProperties in demo app:

void CFilePropertiesTestDlg::OnXfileprops()
    CString str;

    CXFileProperties *pDlg = new CXFileProperties(str, this);

    if (!pDlg)


Revision History

Version 1.0 - 2003 June 14

  • Initial public release.


This software is released into the public domain. You are free to use it in any way you like. If you modify it or extend it, please to consider posting new code here for everyone to share. This software is provided "as is" with no expressed or implied warranty. I accept no liability for any damage or loss of business that this software may cause.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Hans Dietrich
Software Developer (Senior) Hans Dietrich Software
United States United States
I attended St. Michael's College of the University of Toronto, with the intention of becoming a priest. A friend in the University's Computer Science Department got me interested in programming, and I have been hooked ever since.

Recently, I have moved to Los Angeles where I am doing consulting and development work.

For consulting and custom software development, please see

You may also be interested in...


Comments and Discussions

GeneralThe trick for displaying the Windows properties dialog Pin
pryhoda25-Aug-04 7:34
memberpryhoda25-Aug-04 7:34 
GeneralRe: The trick for displaying the Windows properties dialog Pin
pryhoda25-Aug-04 7:35
memberpryhoda25-Aug-04 7:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 14 Jun 2003
Article Copyright 2003 by Hans Dietrich
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid