Results 1 to 4 of 4

Thread: Display File Properties [Solved]

  1. #1
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Display File Properties [Solved]

    Hi all,

    For my application, I would like to be able to display the file properties in the standard Windows dialogs that you see when you do right click->properties on a file.

    Now it seens that there are some ways to do that, but so far I have found none that actually seem to work when using standard c++ or qt insteas of Visual c++.

    I tried to use CPropertyPage from microsoft itself (http://msdn.microsoft.com/en-us/library/y9a2ksw2.aspx) but that gives a huge amount of compiler errors, due to not-existing files, and declarations that do not seem to name a type.

    So my question is, does anyone have a simple, working example of how to do this?

    Info:
    QT: 4.4.3
    Platform Windows XP SP2
    Last edited by DrDonut; 5th May 2009 at 13:33.

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display File Properties

    Use QFileInfo class
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Mar 2008
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Display File Properties

    Wow Thanks, I'll have to take a look at that to get my code to be platform-independant.

    In the mean time I fixed it with some windows-only code:
    Qt Code:
    1. SHELLEXECUTEINFO ShellExecuteInfo;
    2.  
    3. ShellExecuteInfo.cbSize = sizeof(ShellExecuteInfo);
    4. ShellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_INVOKEIDLIST | SEE_MASK_FLAG_NO_UI;
    5. ShellExecuteInfo.hwnd = widget->winId();
    6. ShellExecuteInfo.lpVerb = prop;
    7. ShellExecuteInfo.lpFile = WFileName;
    8. ShellExecuteInfo.lpParameters = NULL;
    9. ShellExecuteInfo.lpDirectory = NULL;
    10. ShellExecuteInfo.nShow = 0;
    11. ShellExecuteInfo.hInstApp = 0;
    12. ShellExecuteInfo.lpIDList = 0;
    13.  
    14. return ShellExecuteEx(&ShellExecuteInfo);
    To copy to clipboard, switch view to plain text mode 

    But I will take a look at the QFileInfo class, thanks!

  4. #4
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Display File Properties [Solved]

    the CPropertyPage (as every class in windows starting from "C" at the beginning) is a part of MFC - so I assume that you didn't set up your project to compile and link with MFC headers/libraries and that caused so many errors
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

Similar Threads

  1. how to display DGN file
    By Nithya in forum Qt Programming
    Replies: 8
    Last Post: 24th April 2008, 11:23
  2. Display a file from Directory tree to show in QTextEdit
    By vvdounai in forum Qt Programming
    Replies: 1
    Last Post: 13th November 2007, 14:43
  3. Can't display .jpg,.jpeg file in my QT app
    By Shalabh in forum Qt Programming
    Replies: 3
    Last Post: 23rd April 2007, 15:52
  4. How to display a file in the textBrowser
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 26th October 2006, 20:47
  5. Replies: 5
    Last Post: 16th May 2006, 21:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.