Solved

The PIDL Riddle - or: How to get my CSIDL_ back from the PIDL

Posted on 2009-06-30
6
604 Views
Last Modified: 2013-12-14
Hello

I'm using C++ Builder an Win.

Does any one know how to get a CSDIL_ from/over a PIDL?

Reason:
By browsing the (Deskop) Folder and showing the contents in a TreeView, I want to be able to exclude CSIDL_ADMINTOOLS, CSIDL_DRIVES, CSIDL_PRINTERS .... or even not from the TreeView.

If you have a nice CSIDL_, it is easy to get a good PIDL.
But what if you hav a PIDL and want to get the appropriate CSIDL_?

Can any one help me please?

Thanks in advance!
0
Comment
Question by:hasnpapa
  • 3
6 Comments
 
LVL 49

Accepted Solution

by:
DanRollins earned 500 total points
ID: 24760486
For Windows Vista, you can use:
SHGetKnownFolderIDList Function
http://msdn.microsoft.com/en-us/library/bb762187(VS.85).aspx

(what they call a "KNOWNFOLDERID" is just a CSIDL_xxxx value)
For earlier OSes:
I've never tried it, but it seems possible that you could get the filesystem path for the items you need to exclude, then compare the filesystem path of the PIDLs that you have.
    SHGetSpecialFolderLocation
    http://msdn.microsoft.com/en-us/library/bb762203(VS.85).aspx
    SHGetSpecialFolderPath
    http://msdn.microsoft.com/en-us/library/bb762204(VS.85).aspx
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 24760513
It might also be worth while to look at :
    SHGetFileInfo Function
    http://msdn.microsoft.com/en-us/library/bb762179(VS.85).aspx
You can pass it a PIDL and the flag SHGFI_DISPLAYNAME and perhaps work from that.
0
 

Author Comment

by:hasnpapa
ID: 24761835
To identify the folders on theyr path is the idea tht helps!

I'm using i.e.:
SHGetSpecialFolderLocation(NULL, CSIDL_BITBUCKET , &pidl)
and
GetDisplayName(desktops_ShellFolder, pidl, TRUE);
which returns something like
::{21EC2020-3AEA-1069-A2DD-08002B30309D}

Thats the way to identify it later :-)

Thank a lot for bringing me on the right way! :-)


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 24770679
Glad to help.  Thanks for the points and the grade.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question