🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Shbrowseforfolder edit box problems

#2346
From: Mark Jacobs
Date: Mon, 05 Mar 2007 12:46
39 lines
2519 bytes
I am using BCB5 Pro SP1, and I have the following code :-

int CALLBACK mjBrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lParam,LPARAM 
lpData)
{
  if (uMsg==BFFM_INITIALIZED) SendMessage(hwnd,BFFM_SETSELECTION,TRUE,lpData);
  return 0;
}
//---------------------------------------------------------------------------
void __fastcall Tmjgrabstr::xbtnClick(TObject *Sender)
{
  AnsiString Dir=Edit1->Text;
  BROWSEINFO mjbi;
  char rcvdir[999];
  if (!DirectoryExists(Dir)) Dir=GetCurrentDir();
  strcpy(rcvdir,Dir.c_str());
  mjbi.hwndOwner=Application->Handle;
  mjbi.pidlRoot=0;
  mjbi.pszDisplayName=rcvdir;
  mjbi.lpszTitle="Choose a Directory :-";
  mjbi.ulFlags=BIF_USENEWUI;
  mjbi.lpfn=mjBrowseCallbackProc;
  mjbi.lParam=(long)rcvdir;
  ITEMIDLIST *mjites=SHBrowseForFolder(&mjbi);
  rcvdir[0]='\0'; if (mjites) SHGetPathFromIDList(mjites,rcvdir);
  CoTaskMemFree(mjites);
  if (rcvdir[0]) Edit1->Text=AnsiString(rcvdir);
}

This is to present a directory selector with an edit box to manually enter a 
directory name. The directory chosen or entered, does not have to exist. When 
the dialog appears, it changes itself to the current directory. When I enter 
text into the edit box on this dialog, and hit OK, the dialog returns the 
directory in the window above the text box, but not that entered into the text 
box itself. How do I get to the text in the edit box in this dialog?
-- 
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
Technical Details
Message-ID: <45ec10db$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.google.com!news.germany.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,149a673c2d92f69f,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?BorlandNG>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Shbrowseforfolder edit box problems
Date: Mon, 5 Mar 2007 12:46:09 -0000
Lines: 40
Organization: DK Computing
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 81.144.157.8
Message-ID: <45ec10db$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1173098715 81.144.157.8 (5 Mar 2007 04:45:15 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.google.com!news.germany.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail