Article View: borland.public.cppbuilder.nativeapi
Article #2358Re: Shbrowseforfolder edit box problems
From: Remy Lebeau (TeamB)
Date: Mon, 05 Mar 2007 23:47
Date: Mon, 05 Mar 2007 23:47
44 lines
2562 bytes
2562 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:5t6pu2922athot41785ihioe33et7h0mao@4ax.com...
> I seem to always get a pidl returned when Validate closes
> the dialog (return 0;)
The only way a non-NULL ITEMIDLIST can be returned is if there is a
valid folder selected in the dialog's TreeView when the dialog is
closed.
I tested the code before I posting it, and was able to get the edit
box's text as expected, even with a folder selected in the TreeView,
as the edit box has priority.
> So the above should always run unless the Cancel was pressed.
> But that would overwrite the manual entry copied by the Validate
code.
No, it would not. The value would remain untouched when canceling the
dialog. However, because a NULL ITEMIDLIST is returned when the
dialog is cancelled, there is no way to differentiate between a cancel
and a failed validation.
> That's why I checked rcvdir[0] instead of mjites after the call.
If the dialog returns a valid ITEMIDLIST, you have to use that as the
chosen path, so you should be checking the ITEMIDLIST first before
then falling back to the captured value.
> if( rcvdir[0] == 0 )
> {
> > SHGetPathFromIDList(mjites, rcvdir);
> }else{
> //nothing, rcvdir filled in by Validate
> };
That condition can never happen. If the dialog returns a valid
ITEMIDLIST, then the edit box text had to pass validation first, so
the contents of the captured buffer would not represent the folder the
user actually chose.
Gambit
Technical Details
Message-ID:
<45ecac3f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45ec10db$1@newsgroups.borland.com> <45ec6a71@newsgroups.borland.com> <45ec71a5$1@newsgroups.borland.com> <5t6pu2922athot41785ihioe33et7h0mao@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,149a673c2d92f69f 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: <45ec10db$1@newsgroups.borland.com> <45ec6a71@newsgroups.borland.com> <45ec71a5$1@newsgroups.borland.com> <5t6pu2922athot41785ihioe33et7h0mao@4ax.com> Subject: Re: Shbrowseforfolder edit box problems Date: Mon, 5 Mar 2007 15:47:55 -0800 Lines: 46 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: <45ecac3f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1173138495 75.83.34.171 (5 Mar 2007 15:48:15 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail