发布网友 发布时间:2022-04-24 06:40
共5个回答
热心网友 时间:2022-06-17 01:58
uses FileCtrl;
function SelectDirectory(var Directory: string; // 英文对话框
Options: TSelectDirOpts; HelpCtx: Longint): Boolean; overload;
function SelectDirectory(const Caption: string; // 中文对话框
const Root: WideString;
var Directory: string): Boolean; overload;
//以下是Delphi帮助的Demo:
uses FileCtrl;
const
SELDIRHELP = 1000;
procere TForm1.Button1Click(Sender: TObject);
var
Dir: string;
begin
Dir := 'C:/MYDIR'; // 缺省为C:/MYDIR
if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt],SELDIRHELP) then
Label1.Caption := Dir; // Dir返回选择的文件夹
end;
热心网友 时间:2022-06-17 01:59
filestream.savetofile('你要保存的路径' + '你要保存的文件名');
热心网友 时间:2022-06-17 01:59
用 setcurrentdir(const dir:string) 可以实现
设置当前目录
热心网友 时间:2022-06-17 02:00
var
path :string;
path := ExtractFilePath(Paramstr(0)) + '文件名';
控件.save(path);
热心网友 时间:2022-06-17 02:00
function TData1.DeleteDirectory(const Source:String): boolean;
var
fo: TSHFILEOPSTRUCT;
begin
FillChar(fo, SizeOf(fo), 0);
with fo do
begin
Wnd := 0;
wFunc := FO_DELETE;
pFrom := PChar(source+#0);
pTo := PChar(source+#0);
fFlags := FOF_NOCONFIRMATION+FOF_NOCONFIRMMKDIR ;
end;
Result := (SHFileOperation(fo) = 0);
end;