PDA

View Full Version : Find List of Special Folders in Windows



Dilshad
8th February 2012, 06:22
Hello,
Is it possible to get a list of the Special Folders in Windows 7 using Qt 4.7.4
I need to know in which directory the Operating System is installed and which folders I have write- access to.
Special Folders will include folders like 'Desktop', 'Program Data', etc....
These folders may or may not be hidden.

I appreciate your time and response.
Thank you in advance.

ChrisW67
8th February 2012, 06:52
Useful locations for data storage can be found using QDesktopServices. If you require all the Windows special folders then you will need to use the Windows API, e.g. SHGetKnownFolderPath function (http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188%28v=vs.85%29.aspx) or GetSystemDirectory function (http://msdn.microsoft.com/en-us/library/windows/desktop/ms724373%28v=vs.85%29.aspx)

Dilshad
8th February 2012, 08:02
Thanks Chris.
I had another Query. Can I find out the Special folders without knowing their ID's?

ChrisW67
8th February 2012, 08:32
The Windows API has a way to enumerate all the special folders: search for Known Folders at MSDN.

You have all the options for QDesktopServices.

Dilshad
8th February 2012, 11:49
The Windows API has a way to enumerate all the special folders: search for Known Folders at MSDN.

You have all the options for QDesktopServices.

Thanks Chris.
Do you know of any other way other than using MFC

ChrisW67
9th February 2012, 03:18
Why would there be another way? To get the operating system's idea of something you ask the operating system using the mechanisms the operating system offers.

BTW: Nothing to do with MFC. This is straight Windows API code.

Dilshad
13th February 2012, 04:13
Why would there be another way? To get the operating system's idea of something you ask the operating system using the mechanisms the operating system offers.

BTW: Nothing to do with MFC. This is straight Windows API code.

Thanks a lot Chris. Been very helpful.