BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TOpenDialog selecting directory

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Raul Lorenzo
Guest





PostPosted: Sun Feb 19, 2006 7:03 pm    Post subject: TOpenDialog selecting directory Reply with quote



Hi,

How could I select a directory from a TOpenDialog without selecting the
file containing in it?

Thanks in advance
Back to top
Raul Lorenzo
Guest





PostPosted: Sun Feb 19, 2006 7:03 pm    Post subject: Re: TOpenDialog selecting directory Reply with quote



But, Do I call OpenDialog1->Execute() first?

HF escribió:
Quote:
Better to use SHBrowseForFolder from Shell's Namespace Functions

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
BROWSEINFO bi;
char lpBuffer[MAX_PATH];
memset(&bi,0,sizeof(BROWSEINFO));

bi.hwndOwner = this->Handle;
bi.pidlRoot = NULL;
bi.pszDisplayName = lpBuffer;

bi.lpszTitle = "Choose a folder";
bi.ulFlags = 0;
bi.lpfn = NULL;
bi.lParam = 0;

// Browse for a folder and return its PIDL.
LPITEMIDLIST pidlBrowse = SHBrowseForFolder(&bi);
if (pidlBrowse != NULL) {
char dirPath[MAX_PATH]="";
SHGetPathFromIDList(pidlBrowse,dirPath);
ShowMessage(dirPath);
}

}
//---------------------------------------------------------------------------

-minas
? "Raul Lorenzo" <rlorenb (AT) agalisa (DOT) es> ?????? ??? ??????
news:43f8b096 (AT) newsgroups (DOT) borland.com...
Hi,

How could I select a directory from a TOpenDialog without selecting the
file containing in it?

Thanks in advance

Back to top
HF
Guest





PostPosted: Sun Feb 19, 2006 7:03 pm    Post subject: Re: TOpenDialog selecting directory Reply with quote



No you don't need OpenDialog at all.
-minas
Back to top
HF
Guest





PostPosted: Sun Feb 19, 2006 7:03 pm    Post subject: Re: TOpenDialog selecting directory Reply with quote

Better to use SHBrowseForFolder from Shell's Namespace Functions

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
BROWSEINFO bi;
char lpBuffer[MAX_PATH];
memset(&bi,0,sizeof(BROWSEINFO));

bi.hwndOwner = this->Handle;
bi.pidlRoot = NULL;
bi.pszDisplayName = lpBuffer;

bi.lpszTitle = "Choose a folder";
bi.ulFlags = 0;
bi.lpfn = NULL;
bi.lParam = 0;

// Browse for a folder and return its PIDL.
LPITEMIDLIST pidlBrowse = SHBrowseForFolder(&bi);
if (pidlBrowse != NULL) {
char dirPath[MAX_PATH]="";
SHGetPathFromIDList(pidlBrowse,dirPath);
ShowMessage(dirPath);
}

}
//---------------------------------------------------------------------------

-minas
? "Raul Lorenzo" <rlorenb (AT) agalisa (DOT) es> ?????? ??? ??????
news:43f8b096 (AT) newsgroups (DOT) borland.com...
Quote:
Hi,

How could I select a directory from a TOpenDialog without selecting the
file containing in it?

Thanks in advance
Back to top
HF
Guest





PostPosted: Sun Feb 19, 2006 8:03 pm    Post subject: Re: TOpenDialog selecting directory Reply with quote

sorry I forgot , you must include
#include <shlobj.h>

-minas
Back to top
Michel Leunen
Guest





PostPosted: Sun Feb 19, 2006 9:03 pm    Post subject: Re: TOpenDialog selecting directory Reply with quote

HF wrote:
Quote:
Better to use SHBrowseForFolder from Shell's Namespace Functions

Or use the SelectDirectory() from Builder.

Michel
--
----------------------------------------
Michel Leunen
mailto: see my homepage.
C++Builder, BCC5.5.1 Web site:
http://www.leunen.com/
----------------------------------------
Back to top
JD
Guest





PostPosted: Mon Feb 20, 2006 2:12 am    Post subject: Re: TOpenDialog selecting directory Reply with quote

Raul Lorenzo <rlorenb (AT) agalisa (DOT) es> wrote:
Quote:

How could I select a directory from a TOpenDialog without
selecting the file containing in it?

This question has been asked many, many times before. You
didn't search the archives did you?

http://www.tamaracka.com/search.htm

You can not using TOpenDialog. However, there are 2 choices
available to you where you can select just a folder. One is a
win32 API (SHBrowseForFolder) and the other option is VCL based
(SelectDirectory).

If you use the win32 SHBrowseForFolder, you must also add a
conditionals statement (NO_WIN32_LEAN_AND_MEAN) to the project.

The archives are full of examples.

~ JD
Back to top
JD
Guest





PostPosted: Mon Feb 20, 2006 2:12 am    Post subject: Re: TOpenDialog selecting directory Reply with quote

"HF" <(min_charATyahooPUTADOTgr)(HellenicFire)> wrote:
Quote:


BROWSEINFO bi;
char lpBuffer[MAX_PATH];
memset(&bi,0,sizeof(BROWSEINFO));

Better to just:

BROWSEINFO bi = { 0 };

Quote:
char lpBuffer[MAX_PATH];

That should be:

char lpBuffer[MAX_PATH + 1]; // account for NULL terminator

<snip?

Quote:
// Browse for a folder and return its PIDL.
LPITEMIDLIST pidlBrowse = SHBrowseForFolder(&bi);
if (pidlBrowse != NULL) {
char dirPath[MAX_PATH]="";
SHGetPathFromIDList(pidlBrowse,dirPath);
ShowMessage(dirPath);
}

This code leaks memory because the call to SHBrowseForFolder
allocates memory that the caller is responsible to assume
ownership of. Additionally, the code fails to check the
success of the call to SHGetPathFromIDList.

Have a look at this code (it's ready to be installed into the
IDE as well as a component):

//-------------------------------------------------------------
#ifndef BrowseForFolderH
#define BrowseForFolderH
//-------------------------------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Dialogs.hpp>
#include <DesignIntf.hpp>
//-------------------------------------------------------------
class PACKAGE TBrowseForFolder : public TCommonDialog
{
private:
bool FRetain;
AnsiString FPath;
AnsiString FFolder;
AnsiString FPrompt;
AnsiString FCaption;
AnsiString FInitialFolder;
protected:
static int __stdcall BrowseProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData);
void __fastcall SetCaption( AnsiString TheCaption );
void __fastcall SetInitialPath( AnsiString Path );
public:
__property AnsiString Path = { read = FPath };
__property AnsiString Folder = { read = FFolder };
bool __fastcall Execute();
__fastcall TBrowseForFolder(TComponent* Owner);
__published:
__property AnsiString Prompt = { read = FPrompt, write = FPrompt };
__property AnsiString Caption = { read = FCaption, write = SetCaption };
__property AnsiString InitialFolder = { read = FInitialFolder, write = SetInitialPath };
__property bool RetainSelection = { read = FRetain, write = FRetain };
};
//-------------------------------------------------------------
#endif


//-------------------------------------------------------------
#include <vcl.h>
#include <basepch.h>
#pragma hdrstop
//-------------------------------------------------------------
#include "BrowseForFolder.h"
#include "shlobj.h"
#pragma package(smart_init)
//-------------------------------------------------------------
// These variables are declared here because the EnumChild Call Back and
// the BrowseProc can not access members of the class
HDC DlgCtrlHDC = NULL;
HWND DlgCtrlHWND = NULL;
int DlgCtrlMaxWidth, DlgCtrlCounter;
TForm* pForm = NULL;
TCanvas* DlgCtrlCanvas = NULL;
AnsiString NewCaption = "";
AnsiString InitialPath = "";
//-------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//
static inline void ValidCtrCheck(TBrowseForFolder *)
{
new TBrowseForFolder(NULL);
}
//-------------------------------------------------------------
__fastcall TBrowseForFolder::TBrowseForFolder(TComponent* Owner) : TCommonDialog(Owner)
{
pForm = dynamic_cast<TForm*>( Owner );
}
//-------------------------------------------------------------
BOOL CALLBACK EnumChildCallBack( HWND hWnd, LPARAM lParam )
{
// we're looking for the second instance of "Static"
char WindowClassName[256] = {0};
if( ::GetClassName(hWnd, WindowClassName, 255) )
{
if( stricmp(WindowClassName, (char*)lParam) == 0 )
{
++DlgCtrlCounter;
if( DlgCtrlCounter == 2 )
{
DlgCtrlHWND = hWnd;
return FALSE;
}
}
}
return TRUE;
}
//-------------------------------------------------------------
bool __fastcall TBrowseForFolder::Execute()
{
pForm->Enabled = false;
Application->ProcessMessages();

bool Result = false;
BROWSEINFO bInfo = { 0 };
char FolderPath[ MAX_PATH + 1 ] = { 0 };
char FolderName[ MAX_PATH + 1 ] = { 0 };

bInfo.hwndOwner = pForm->Handle;
bInfo.pidlRoot = NULL;
bInfo.pszDisplayName = FolderName;
bInfo.lpszTitle = FPrompt.c_str();
bInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_EDITBOX; //BIF_USENEWUI;
bInfo.lpfn = BrowseProc;

DlgCtrlHWND = NULL;
DlgCtrlHDC = ::GetDC( NULL );
::SelectObject( DlgCtrlHDC, ::GetStockObject(DEFAULT_GUI_FONT) );
DlgCtrlCanvas = new TCanvas;
DlgCtrlCanvas->Handle = DlgCtrlHDC;

FPath = "";
FFolder = "";
DlgCtrlCounter = 0;
DlgCtrlMaxWidth = 0;

LPITEMIDLIST IDList = ::SHBrowseForFolder( &bInfo );
if( IDList )
{
if( ::SHGetPathFromIDList(IDList, FolderPath) )
{
FPath = AnsiString( FolderPath );
FFolder = AnsiString( FolderName );
Result = true;
}
::CoTaskMemFree( IDList );
}
::ReleaseDC( NULL, DlgCtrlHDC );
delete DlgCtrlCanvas;
if( FRetain && Result ) SetInitialPath( FPath );

pForm->Enabled = true;
return Result;
}
//-------------------------------------------------------------
int __stdcall TBrowseForFolder::BrowseProc( HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData )
{
static TRect R;
if( uMsg == BFFM_INITIALIZED )
{
::GetWindowRect( hWnd, &R );
int DlgHeight = (R.Bottom - R.Top) + 1, DlgWidth = (R.Right - R.Left) + 1;
::GetWindowRect( pForm->Handle, &R );
int left = (R.Left+((R.Right-R.Left)/2)) - (DlgWidth/2), top = (R.Top +((R.Bottom-R.Top)/2)) - (DlgHeight/2);
if( left < 0 ) left = 0; else if( (left+DlgWidth) > Screen->WorkAreaWidth ) left = Screen->WorkAreaWidth - DlgWidth;
if( top < 0 ) top = 0; else if( (top+DlgHeight) > Screen->WorkAreaHeight ) top = Screen->WorkAreaHeight - DlgHeight;
::SetWindowPos( hWnd, 0, left, top, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER );

AnsiString WindowClassName = "Static";
::EnumChildWindows( hWnd, (WNDENUMPROC)EnumChildCallBack, (LPARAM)WindowClassName.c_str() );
::GetWindowRect( DlgCtrlHWND, &R );
DlgCtrlMaxWidth = (R.Right - R.Left) + 1;

if( !NewCaption.IsEmpty() ) ::SetWindowText( hWnd, NewCaption.c_str() );
if( !InitialPath.IsEmpty() ) ::SendMessage( hWnd, BFFM_SETSELECTION, TRUE, (LPARAM) InitialPath.c_str() );
}
else if( uMsg == BFFM_SELCHANGED )
{
TSize S;
char Path[ MAX_PATH + 1 ] = { 0 };
if( ::SHGetPathFromIDList((LPITEMIDLIST)lParam, Path) )
{
if( ::GetTextExtentPoint32( DlgCtrlHDC, PChar(Path), strlen(Path), &S) )
{
if( S.cx > DlgCtrlMaxWidth )
{
::DrawText(DlgCtrlCanvas->Handle, Path, strlen(Path), &R, DT_PATH_ELLIPSIS | DT_SINGLELINE | DT_MODIFYSTRING );
}
}
::SendMessage( hWnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)Path );
}
}
return 0;
}
//-------------------------------------------------------------
void __fastcall TBrowseForFolder::SetInitialPath( AnsiString Path )
{
if( Path.Length() > 3 )
{
while( Path.IsPathDelimiter(Path.Length()) ) Path.Delete( Path.Length(), 1 );
}
FInitialFolder = Path;
InitialPath = Path;
}
//-------------------------------------------------------------
void __fastcall TBrowseForFolder::SetCaption( AnsiString TheCaption )
{
FCaption = TheCaption;
NewCaption = TheCaption;
}
//-------------------------------------------------------------
namespace Browseforfolder
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TBrowseForFolder)};
RegisterComponents("IDEAtum", classes, 0);
TPropInfo *PropInfo = ::GetPropInfo( __typeinfo(TBrowseForFolder), "Ctl3D" );
RegisterPropertyEditor( *(PropInfo->PropType), __classid(TBrowseForFolder), "Ctl3D", NULL );
PropInfo = ::GetPropInfo( __typeinfo(TBrowseForFolder), "HelpContext" );
RegisterPropertyEditor( *(PropInfo->PropType), __classid(TBrowseForFolder), "HelpContext", NULL );
PropInfo = ::GetPropInfo( __typeinfo(TBrowseForFolder), "Tag" );
RegisterPropertyEditor( *(PropInfo->PropType), __classid(TBrowseForFolder), "Tag", NULL );
}
}
//-------------------------------------------------------------

~ JD
Back to top
Alex Petrov
Guest





PostPosted: Mon Feb 20, 2006 9:03 am    Post subject: Re: TOpenDialog selecting directory Reply with quote

If you do need TOpenDialog for selecting folders (not BrowseForFolser) due
to some reasons, please take a look at our Dialog Workshop for
Delphi/C++Builder components:

http://www.componentage.com

These components allow to customize Windows common dialogs in many ways.

There is a sample with exactly this functionality on our web.

Best regards,
Alex


"Raul Lorenzo" <rlorenb (AT) agalisa (DOT) es> wrote in message
news:43f8b096 (AT) newsgroups (DOT) borland.com...
Quote:
Hi,

How could I select a directory from a TOpenDialog without selecting the
file containing in it?

Thanks in advance
Back to top
HF
Guest





PostPosted: Mon Feb 20, 2006 11:03 am    Post subject: Re: TOpenDialog selecting directory Reply with quote

Quote:
BROWSEINFO bi;
char lpBuffer[MAX_PATH];
memset(&bi,0,sizeof(BROWSEINFO));

Better to just:

BROWSEINFO bi = { 0 };

About memset and the syntax {0} I think no problem use both of them

Quote:
char lpBuffer[MAX_PATH];

That should be:

char lpBuffer[MAX_PATH + 1]; // account for NULL terminator

From windef.h

#define MAX_PATH 260
and is included space for the NULL character.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/naming_a_file.asp
example on the D drive is D:\<256 chars>NUL = 260.

so why to use [MAX_PATH+1] ?
-minas
Back to top
Raul Lorenzo
Guest





PostPosted: Mon Feb 20, 2006 11:03 am    Post subject: Re: TOpenDialog selecting directory Reply with quote

I didn´t search in a good site. Thanks about the link.
Sorry for your complain, I will try to improve my searches

JD escribió:
Quote:
Raul Lorenzo <rlorenb (AT) agalisa (DOT) es> wrote:
How could I select a directory from a TOpenDialog without
selecting the file containing in it?

This question has been asked many, many times before. You
didn't search the archives did you?

http://www.tamaracka.com/search.htm

You can not using TOpenDialog. However, there are 2 choices
available to you where you can select just a folder. One is a
win32 API (SHBrowseForFolder) and the other option is VCL based
(SelectDirectory).

If you use the win32 SHBrowseForFolder, you must also add a
conditionals statement (NO_WIN32_LEAN_AND_MEAN) to the project.

The archives are full of examples.

~ JD
Back to top
smartdude80
Guest





PostPosted: Fri Mar 03, 2006 2:03 am    Post subject: Re: TOpenDialog selecting directory Reply with quote

How do you compile this code into a component. Will it work with all
versions of c++ builder?


Quote:
This code leaks memory because the call to SHBrowseForFolder
allocates memory that the caller is responsible to assume
ownership of. Additionally, the code fails to check the
success of the call to SHGetPathFromIDList.

Have a look at this code (it's ready to be installed into the
IDE as well as a component):

//-------------------------------------------------------------
#ifndef BrowseForFolderH
#define BrowseForFolderH
//-------------------------------------------------------------
#include <SysUtils.hpp
#include <Classes.hpp
#include <Dialogs.hpp
#include <DesignIntf.hpp
//-------------------------------------------------------------
class PACKAGE TBrowseForFolder : public TCommonDialog
{
private:
bool FRetain;
AnsiString FPath;
AnsiString FFolder;
AnsiString FPrompt;
AnsiString FCaption;
AnsiString FInitialFolder;
protected:
static int __stdcall BrowseProc(HWND hwnd, UINT uMsg, LPARAM
lParam, LPARAM lpData);
void __fastcall SetCaption( AnsiString TheCaption );
void __fastcall SetInitialPath( AnsiString Path );
public:
__property AnsiString Path = { read = FPath };
__property AnsiString Folder = { read = FFolder };
bool __fastcall Execute();
__fastcall TBrowseForFolder(TComponent* Owner);
__published:
__property AnsiString Prompt = { read = FPrompt, write =
FPrompt };
__property AnsiString Caption = { read = FCaption, write =
SetCaption };
__property AnsiString InitialFolder = { read = FInitialFolder,
write = SetInitialPath };
__property bool RetainSelection = { read = FRetain, write = FRetain };
};
//-------------------------------------------------------------
#endif


//-------------------------------------------------------------
#include <vcl.h
#include <basepch.h
#pragma hdrstop
//-------------------------------------------------------------
#include "BrowseForFolder.h"
#include "shlobj.h"
#pragma package(smart_init)
//-------------------------------------------------------------
// These variables are declared here because the EnumChild Call Back and
// the BrowseProc can not access members of the class
HDC DlgCtrlHDC = NULL;
HWND DlgCtrlHWND = NULL;
int DlgCtrlMaxWidth, DlgCtrlCounter;
TForm* pForm = NULL;
TCanvas* DlgCtrlCanvas = NULL;
AnsiString NewCaption = "";
AnsiString InitialPath = "";
//-------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//
static inline void ValidCtrCheck(TBrowseForFolder *)
{
new TBrowseForFolder(NULL);
}
//-------------------------------------------------------------
__fastcall TBrowseForFolder::TBrowseForFolder(TComponent* Owner) :
TCommonDialog(Owner)
{
pForm = dynamic_cast<TForm*>( Owner );
}
//-------------------------------------------------------------
BOOL CALLBACK EnumChildCallBack( HWND hWnd, LPARAM lParam )
{
// we're looking for the second instance of "Static"
char WindowClassName[256] = {0};
if( ::GetClassName(hWnd, WindowClassName, 255) )
{
if( stricmp(WindowClassName, (char*)lParam) == 0 )
{
++DlgCtrlCounter;
if( DlgCtrlCounter == 2 )
{
DlgCtrlHWND = hWnd;
return FALSE;
}
}
}
return TRUE;
}
//-------------------------------------------------------------
bool __fastcall TBrowseForFolder::Execute()
{
pForm->Enabled = false;
Application->ProcessMessages();

bool Result = false;
BROWSEINFO bInfo = { 0 };
char FolderPath[ MAX_PATH + 1 ] = { 0 };
char FolderName[ MAX_PATH + 1 ] = { 0 };

bInfo.hwndOwner = pForm->Handle;
bInfo.pidlRoot = NULL;
bInfo.pszDisplayName = FolderName;
bInfo.lpszTitle = FPrompt.c_str();
bInfo.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT |
BIF_EDITBOX; //BIF_USENEWUI;
bInfo.lpfn = BrowseProc;

DlgCtrlHWND = NULL;
DlgCtrlHDC = ::GetDC( NULL );
::SelectObject( DlgCtrlHDC, ::GetStockObject(DEFAULT_GUI_FONT) );
DlgCtrlCanvas = new TCanvas;
DlgCtrlCanvas->Handle = DlgCtrlHDC;

FPath = "";
FFolder = "";
DlgCtrlCounter = 0;
DlgCtrlMaxWidth = 0;

LPITEMIDLIST IDList = ::SHBrowseForFolder( &bInfo );
if( IDList )
{
if( ::SHGetPathFromIDList(IDList, FolderPath) )
{
FPath = AnsiString( FolderPath );
FFolder = AnsiString( FolderName );
Result = true;
}
::CoTaskMemFree( IDList );
}
::ReleaseDC( NULL, DlgCtrlHDC );
delete DlgCtrlCanvas;
if( FRetain && Result ) SetInitialPath( FPath );

pForm->Enabled = true;
return Result;
}
//-------------------------------------------------------------
int __stdcall TBrowseForFolder::BrowseProc( HWND hWnd, UINT uMsg, LPARAM
lParam, LPARAM lpData )
{
static TRect R;
if( uMsg == BFFM_INITIALIZED )
{
::GetWindowRect( hWnd, &R );
int DlgHeight = (R.Bottom - R.Top) + 1, DlgWidth = (R.Right -
R.Left) + 1;
::GetWindowRect( pForm->Handle, &R );
int left = (R.Left+((R.Right-R.Left)/2)) - (DlgWidth/2), top =
(R.Top +((R.Bottom-R.Top)/2)) - (DlgHeight/2);
if( left < 0 ) left = 0; else if( (left+DlgWidth)
Screen->WorkAreaWidth ) left = Screen->WorkAreaWidth - DlgWidth;
if( top < 0 ) top = 0; else if( (top+DlgHeight)
Screen->WorkAreaHeight ) top = Screen->WorkAreaHeight - DlgHeight;
::SetWindowPos( hWnd, 0, left, top, 0, 0, SWP_NOACTIVATE |
SWP_NOSIZE | SWP_NOZORDER );

AnsiString WindowClassName = "Static";
::EnumChildWindows( hWnd, (WNDENUMPROC)EnumChildCallBack,
(LPARAM)WindowClassName.c_str() );
::GetWindowRect( DlgCtrlHWND, &R );
DlgCtrlMaxWidth = (R.Right - R.Left) + 1;

if( !NewCaption.IsEmpty() ) ::SetWindowText( hWnd,
NewCaption.c_str() );
if( !InitialPath.IsEmpty() ) ::SendMessage( hWnd,
BFFM_SETSELECTION, TRUE, (LPARAM) InitialPath.c_str() );
}
else if( uMsg == BFFM_SELCHANGED )
{
TSize S;
char Path[ MAX_PATH + 1 ] = { 0 };
if( ::SHGetPathFromIDList((LPITEMIDLIST)lParam, Path) )
{
if( ::GetTextExtentPoint32( DlgCtrlHDC, PChar(Path),
strlen(Path), &S) )
{
if( S.cx > DlgCtrlMaxWidth )
{
::DrawText(DlgCtrlCanvas->Handle, Path,
strlen(Path), &R, DT_PATH_ELLIPSIS | DT_SINGLELINE | DT_MODIFYSTRING );
}
}
::SendMessage( hWnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)Path );
}
}
return 0;
}
//-------------------------------------------------------------
void __fastcall TBrowseForFolder::SetInitialPath( AnsiString Path )
{
if( Path.Length() > 3 )
{
while( Path.IsPathDelimiter(Path.Length()) ) Path.Delete(
Path.Length(), 1 );
}
FInitialFolder = Path;
InitialPath = Path;
}
//-------------------------------------------------------------
void __fastcall TBrowseForFolder::SetCaption( AnsiString TheCaption )
{
FCaption = TheCaption;
NewCaption = TheCaption;
}
//-------------------------------------------------------------
namespace Browseforfolder
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] =
{__classid(TBrowseForFolder)};
RegisterComponents("IDEAtum", classes, 0);
TPropInfo *PropInfo = ::GetPropInfo(
__typeinfo(TBrowseForFolder), "Ctl3D" );
RegisterPropertyEditor( *(PropInfo->PropType),
__classid(TBrowseForFolder), "Ctl3D", NULL );
PropInfo = ::GetPropInfo( __typeinfo(TBrowseForFolder),
"HelpContext" );
RegisterPropertyEditor( *(PropInfo->PropType),
__classid(TBrowseForFolder), "HelpContext", NULL );
PropInfo = ::GetPropInfo( __typeinfo(TBrowseForFolder),
"Tag" );
RegisterPropertyEditor( *(PropInfo->PropType),
__classid(TBrowseForFolder), "Tag", NULL );
}
}
//-------------------------------------------------------------

~ JD
Back to top
JD
Guest





PostPosted: Fri Mar 03, 2006 10:03 am    Post subject: Re: TOpenDialog selecting directory Reply with quote

"smartdude80" <smartdude81 (AT) comcast (DOT) net> wrote:
Quote:


Please trim your posts.

Quote:
How do you compile this code into a component.

You need to post this question to the vcl.writing group. AFAIK,
the exact steps are different from version to version so be
sure to include what version you're using.

Quote:
Will it work with all versions of c++ builder?

With the exception of a TCanvas (which can be eliminated), It's
all win32 API so yes, it will work with any version. However,
you may have to change some of the #include(s) because Borland
may have changed them from version to version.

~ JD
Back to top
Rudy Velthuis [TeamB]
Guest





PostPosted: Fri Mar 03, 2006 7:03 pm    Post subject: Re: TOpenDialog selecting directory Reply with quote

At 02:35:16, 03.03.2006, smartdude80 wrote:

Quote:
How do you compile this code into a component. Will it work with all
versions of c++ builder?

Dude! I don't think it was necessary to quote more than 230 lines just to
add one of your own. I cancelled your post. The content of what you said
is not lost, since I quoted it above.
--
Rudy Velthuis [TeamB] http://rvelthuis.de/

"Honolulu, it's got everything. Sand for the children, sun for the wife,
and sharks for the wife's mother." - Ken Dodd.
Back to top
smartdude80
Guest





PostPosted: Fri Mar 03, 2006 11:03 pm    Post subject: Re: TOpenDialog selecting directory Reply with quote

Anyhow your program(that compiles into a package) seems to be working now.
Thanks.


"JD" <nospam (AT) nospam (DOT) com> wrote in message
news:44080486$1 (AT) newsgroups (DOT) borland.com...

Quote:
How do you compile this code into a component.

You need to post this question to the vcl.writing group. AFAIK,
the exact steps are different from version to version so be
sure to include what version you're using.

Will it work with all versions of c++ builder?

With the exception of a TCanvas (which can be eliminated), It's
all win32 API so yes, it will work with any version. However,
you may have to change some of the #include(s) because Borland
may have changed them from version to version.

~ JD
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.