Solved

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

Posted on 2009-06-30
6
602 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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: …
One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now