🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages Started by DreamChaser Thu, 22 Mar 2007 03:10
What is my PIDL?
#2203
Author: DreamChaser
Date: Thu, 22 Mar 2007 03:10
10 lines
1103 bytes
I've been looking at the SHBrowseForFolder() API call. But I can't 
figure out how to set a "default" folder selection. I see that I can 
send a BFFM_SETSELECTION message to the dialog, but The lParam parameter 
is the PIDL of the folder to select.

So here's my question: Given "C:\My Dir\"; How do I get the PIDL?

Thanks in advance

DC
Re: What is my PIDL?
#2204
Author: Remy Lebeau (TeamB)
Date: Thu, 22 Mar 2007 06:57
33 lines
2320 bytes
"DreamChaser" <NO-Spam@No-Span.net> wrote in message
news:4601f386$1@newsgroups.borland.com...

> I've been looking at the SHBrowseForFolder() API call.
> But I can't figure out how to set a "default" folder selection.

You need to set a callback function via the lpfn member of the
BROWSEINFO structure.  Inside the callback function, send a
BFFM_SETSELECTION message to the provided HWND.

> The lParam parameter is the PIDL of the folder to select.

Only if you set the wParam value of the message to FALSE.  If you set
it to TRUE instead, then you can specify the folder as a
null-terminated string instead.  Note, however, that the dialog is
sensitive to trailing backslashes on the path if you use a string.  If
the folder is the root of a drive, then you have to make sure that the
trailing backslash is present.  If the folder is not the root, then
you have to strip off the trailing backslash instead.  If you do not,
the folder will not be selected properly.  This behavior is not
documented by Microsoft.  I determined it over time when using
SHBrowseForFolder() in several different projects.  Use a PIDL when
possible.  It is more accurate.

> Given "C:\My Dir\"; How do I get the PIDL?

Use SHGetDesktopFolder() to get an IShellFolder interface pointer for
the top-level Desktop namespace, and then pass the full folder path to
the IShellFolder::ParseDisplayName() method.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads