谢!
7 个解决方案
#1
有啊。就是 SelectDirectory 。有两个版本,一个是Win31的界面,一个是
Win32的界面。
Win32的界面。
#2
我用的是BCB5,可能是BCB有BUG,使用这个函数无法连接通过.
#3
Brings up a dialog to allow the user to enter a directory name.
Unit
FileCtrl
Category
dialog and message routines
extern PACKAGE bool __fastcall SelectDirectory(const AnsiString Caption, const WideString Root, AnsiString &Directory);
extern PACKAGE bool __fastcall SelectDirectory(AnsiString &Directory, TSelectDirOpts Options, int HelpCtx);
Description
Call SelectDirectory to let the user enter a directory name.
Use the first syntax to display the Windows directory browser. The Caption parameter specifies a caption for the dialog. The Root parameter specifies the root directory from which to browse. The selected directory is returned as the Directory parameter. When using this syntax, SelectDirectory does not change the value of the current directory.
Warning: You can’t use the same variable for the Root parameter and the Directory parameter.
Use the second syntax to call the Select Directory dialog box. The directory passed to the function with the Directory parameter appears as the currently selected directory when the dialog box appears. The name of the directory the user selects becomes the value of Directory when the function returns.
The HelpCtx parameter is the help context ID number.
The Options parameter is a set of values. If Options is the empty set, the user can only select a directory that already exists. No edit box is provided for the user to enter a new directory name. If Options is not empty, the included values determine how the dialog responds when the user types a nonexistent directory name.
With either syntax, SelectDirectory returns true if the user selected a directory and chose OK, and false if the user chose Cancel or closed the dialog box without selecting a directory.
Unit
FileCtrl
Category
dialog and message routines
extern PACKAGE bool __fastcall SelectDirectory(const AnsiString Caption, const WideString Root, AnsiString &Directory);
extern PACKAGE bool __fastcall SelectDirectory(AnsiString &Directory, TSelectDirOpts Options, int HelpCtx);
Description
Call SelectDirectory to let the user enter a directory name.
Use the first syntax to display the Windows directory browser. The Caption parameter specifies a caption for the dialog. The Root parameter specifies the root directory from which to browse. The selected directory is returned as the Directory parameter. When using this syntax, SelectDirectory does not change the value of the current directory.
Warning: You can’t use the same variable for the Root parameter and the Directory parameter.
Use the second syntax to call the Select Directory dialog box. The directory passed to the function with the Directory parameter appears as the currently selected directory when the dialog box appears. The name of the directory the user selects becomes the value of Directory when the function returns.
The HelpCtx parameter is the help context ID number.
The Options parameter is a set of values. If Options is the empty set, the user can only select a directory that already exists. No edit box is provided for the user to enter a new directory name. If Options is not empty, the included values determine how the dialog responds when the user types a nonexistent directory name.
With either syntax, SelectDirectory returns true if the user selected a directory and chose OK, and false if the user chose Cancel or closed the dialog box without selecting a directory.
#4
可以用SelectDirectory函数的.
不过我发现在DELPHI中该函数可以设置初始目录,在BCB中好象不能,不知是何故?
你也可以直接用API做.
#5
同意季大侠!呵呵!
#6
//压缩前检验要保存的文件名称是否存在!
if(FileExists(tagdirpath))
{
String showmessage=filename.Trim()+"存在,是否覆盖Y/N?" ;
if(Application->MessageBox(showmessage.c_str(),"提示...",MB_YESNO )==IDYES) ;
else
{
AnsiString Dir = "";
AnsiString Dir2 = "";
SelectDirectory("另存为路径",Dir,Dir2) ;
tagdirpath=Dir2+"\\"+filename ;
}
}
if(FileExists(tagdirpath))
{
String showmessage=filename.Trim()+"存在,是否覆盖Y/N?" ;
if(Application->MessageBox(showmessage.c_str(),"提示...",MB_YESNO )==IDYES) ;
else
{
AnsiString Dir = "";
AnsiString Dir2 = "";
SelectDirectory("另存为路径",Dir,Dir2) ;
tagdirpath=Dir2+"\\"+filename ;
}
}
#7
AnsiString S;
S = "";
if (SelectDirectory("Select Directory", "", S))
{
Edit1->Text=S;
}
S = "";
if (SelectDirectory("Select Directory", "", S))
{
Edit1->Text=S;
}
#1
有啊。就是 SelectDirectory 。有两个版本,一个是Win31的界面,一个是
Win32的界面。
Win32的界面。
#2
我用的是BCB5,可能是BCB有BUG,使用这个函数无法连接通过.
#3
Brings up a dialog to allow the user to enter a directory name.
Unit
FileCtrl
Category
dialog and message routines
extern PACKAGE bool __fastcall SelectDirectory(const AnsiString Caption, const WideString Root, AnsiString &Directory);
extern PACKAGE bool __fastcall SelectDirectory(AnsiString &Directory, TSelectDirOpts Options, int HelpCtx);
Description
Call SelectDirectory to let the user enter a directory name.
Use the first syntax to display the Windows directory browser. The Caption parameter specifies a caption for the dialog. The Root parameter specifies the root directory from which to browse. The selected directory is returned as the Directory parameter. When using this syntax, SelectDirectory does not change the value of the current directory.
Warning: You can’t use the same variable for the Root parameter and the Directory parameter.
Use the second syntax to call the Select Directory dialog box. The directory passed to the function with the Directory parameter appears as the currently selected directory when the dialog box appears. The name of the directory the user selects becomes the value of Directory when the function returns.
The HelpCtx parameter is the help context ID number.
The Options parameter is a set of values. If Options is the empty set, the user can only select a directory that already exists. No edit box is provided for the user to enter a new directory name. If Options is not empty, the included values determine how the dialog responds when the user types a nonexistent directory name.
With either syntax, SelectDirectory returns true if the user selected a directory and chose OK, and false if the user chose Cancel or closed the dialog box without selecting a directory.
Unit
FileCtrl
Category
dialog and message routines
extern PACKAGE bool __fastcall SelectDirectory(const AnsiString Caption, const WideString Root, AnsiString &Directory);
extern PACKAGE bool __fastcall SelectDirectory(AnsiString &Directory, TSelectDirOpts Options, int HelpCtx);
Description
Call SelectDirectory to let the user enter a directory name.
Use the first syntax to display the Windows directory browser. The Caption parameter specifies a caption for the dialog. The Root parameter specifies the root directory from which to browse. The selected directory is returned as the Directory parameter. When using this syntax, SelectDirectory does not change the value of the current directory.
Warning: You can’t use the same variable for the Root parameter and the Directory parameter.
Use the second syntax to call the Select Directory dialog box. The directory passed to the function with the Directory parameter appears as the currently selected directory when the dialog box appears. The name of the directory the user selects becomes the value of Directory when the function returns.
The HelpCtx parameter is the help context ID number.
The Options parameter is a set of values. If Options is the empty set, the user can only select a directory that already exists. No edit box is provided for the user to enter a new directory name. If Options is not empty, the included values determine how the dialog responds when the user types a nonexistent directory name.
With either syntax, SelectDirectory returns true if the user selected a directory and chose OK, and false if the user chose Cancel or closed the dialog box without selecting a directory.
#4
可以用SelectDirectory函数的.
不过我发现在DELPHI中该函数可以设置初始目录,在BCB中好象不能,不知是何故?
你也可以直接用API做.
#5
同意季大侠!呵呵!
#6
//压缩前检验要保存的文件名称是否存在!
if(FileExists(tagdirpath))
{
String showmessage=filename.Trim()+"存在,是否覆盖Y/N?" ;
if(Application->MessageBox(showmessage.c_str(),"提示...",MB_YESNO )==IDYES) ;
else
{
AnsiString Dir = "";
AnsiString Dir2 = "";
SelectDirectory("另存为路径",Dir,Dir2) ;
tagdirpath=Dir2+"\\"+filename ;
}
}
if(FileExists(tagdirpath))
{
String showmessage=filename.Trim()+"存在,是否覆盖Y/N?" ;
if(Application->MessageBox(showmessage.c_str(),"提示...",MB_YESNO )==IDYES) ;
else
{
AnsiString Dir = "";
AnsiString Dir2 = "";
SelectDirectory("另存为路径",Dir,Dir2) ;
tagdirpath=Dir2+"\\"+filename ;
}
}
#7
AnsiString S;
S = "";
if (SelectDirectory("Select Directory", "", S))
{
Edit1->Text=S;
}
S = "";
if (SelectDirectory("Select Directory", "", S))
{
Edit1->Text=S;
}