Solved

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Prime numbers are natural numbers greater than 1 that have only two divisors (the number itself and 1). By “divisible” we mean dividend % divisor = 0 (% indicates MODULAR. It gives the reminder of a division operation). We’ll follow multiple approac…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
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…

706 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

14 Experts available now in Live!

Get 1:1 Help Now