🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2204

Re: What is my PIDL?

#2204
From: 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
Technical Details
Message-ID: <46021f23$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4601f386$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,94ed64bf59cfd951
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4601f386$1@newsgroups.borland.com>
Subject: Re: What is my PIDL?
Date: Wed, 21 Mar 2007 22:57:40 -0800
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.34.171
Message-ID: <46021f23$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1174544163 75.83.34.171 (21 Mar 2007 23:16:03 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail