PDA

View Full Version : Display File Properties [Solved]



DrDonut
5th May 2009, 10:32
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

mcosta
5th May 2009, 11:36
Use QFileInfo class

DrDonut
5th May 2009, 13:32
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:


SHELLEXECUTEINFO ShellExecuteInfo;

ShellExecuteInfo.cbSize = sizeof(ShellExecuteInfo);
ShellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_INVOKEIDLIST | SEE_MASK_FLAG_NO_UI;
ShellExecuteInfo.hwnd = widget->winId();
ShellExecuteInfo.lpVerb = prop;
ShellExecuteInfo.lpFile = WFileName;
ShellExecuteInfo.lpParameters = NULL;
ShellExecuteInfo.lpDirectory = NULL;
ShellExecuteInfo.nShow = 0;
ShellExecuteInfo.hInstApp = 0;
ShellExecuteInfo.lpIDList = 0;

return ShellExecuteEx(&ShellExecuteInfo);


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

faldzip
5th May 2009, 13:45
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