Article View: borland.public.cppbuilder.nativeapi
Article #9818Re: SHBrowseForFolder
From: JD
Date: Wed, 09 Jun 2004 09:57
Date: Wed, 09 Jun 2004 09:57
39 lines
2610 bytes
2610 bytes
"Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> wrote:
> [...] That is not the correct way to go. [...]
Yeah, but I have it handled and that was BEFORE you posted
some code. However, to eliminate trailing backslashes, I
replaced Trim with your method because IsPathDelimiter finds
the forward slash as well (which some of us use).
I didn't use the lParam of the BROWSEINFO to pass the initial
folder because it was superfolus since it has to be declared
out side of the class anyway and I added code to center the
dialog over the calling form:
if( uMsg == BFFM_INITIALIZED )
{
TRect R;
SendMessage( hWnd, BFFM_SETSELECTION, TRUE, (LPARAM)InitialPath.c_str() );
if( ::GetWindowRect( hWnd, &R ) )
{
int DialogHeight = (R.Bottom - R.Top) + 1;
int DialogWidth = (R.Right - R.Left) + 1;
if( ::GetWindowRect( pForm->Handle, &R ) )
{
int left = (R.Left+((R.Right-R.Left)/2)) - (DialogWidth/2);
int top = (R.Top +((R.Bottom-R.Top)/2)) - (DialogHeight/2);
if( left < 0 ) left = 0;
else if( (left+DialogWidth) > Screen->WorkAreaWidth ) left = Screen->WorkAreaWidth - DialogWidth;
if( top < 0 ) top = 0;
else if( (top+DialogHeight) > Screen->WorkAreaHeight ) top = Screen->WorkAreaHeight - DialogHeight;
SetWindowPos( hWnd, 0, left, top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER );
}
}
}
There is one more thing that I would like to add and that's
changing the default caption "Brose For Folder". Can I do that?
~ JD
Technical Details
Message-ID:
<40c6deec$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40c56f71$1@newsgroups.borland.com> <40c5fc3b$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,179ca2994416d9ea X-Google-Attributes: gid10cc67,public From: "JD" <nospam@nospam.com> Sender: "JD" <nospam@nospam.com> Reply-To: "JD" <nospam@nospam.com> Subject: Re: SHBrowseForFolder Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 172.157.228.127 References: <40c56f71$1@newsgroups.borland.com> <40c5fc3b$1@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <40c6deec$1@newsgroups.borland.com> Date: 9 Jun 2004 02:57:00 -0700 X-Trace: newsgroups.borland.com 1086775020 207.105.83.66 (9 Jun 2004 02:57:00 -0700) Lines: 40 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail