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

Posted on 2009-06-30
Medium Priority
Last Modified: 2013-12-14

I'm using C++ Builder an Win.

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

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!
Question by:hasnpapa
  • 3
LVL 49

Accepted Solution

DanRollins earned 2000 total points
ID: 24760486
For Windows Vista, you can use:
SHGetKnownFolderIDList Function

(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.
LVL 49

Expert Comment

ID: 24760513
It might also be worth while to look at :
    SHGetFileInfo Function
You can pass it a PIDL and the flag SHGFI_DISPLAYNAME and perhaps work from that.

Author Comment

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

I'm using i.e.:
SHGetSpecialFolderLocation(NULL, CSIDL_BITBUCKET , &pidl)
GetDisplayName(desktops_ShellFolder, pidl, TRUE);
which returns something like

Thats the way to identify it later :-)

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

LVL 49

Expert Comment

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

Featured Post

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Okay. So what exactly is the problem here? How often have we come across situations where we need to know if two strings are 'similar' but not necessarily the same? I have, plenty of times. Until recently, I thought any functionality like that wo…
The greatest common divisor (gcd) of two positive integers is their largest common divisor. Let's consider two numbers 12 and 20. The divisors of 12 are 1, 2, 3, 4, 6, 12 The divisors of 20 are 1, 2, 4, 5, 10 20 The highest number among the c…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

597 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