菜鸟求救 怎么指定一个目录 在用户点击按钮你后(30分)

  • 主题发起人 主题发起人 cgdlin
  • 开始时间 开始时间
C

cgdlin

Unregistered / Unconfirmed
GUEST, unregistred user!
怎么指定一个目录 在用户点击按钮你后
 
如果你说的是当前程序运行目录的话。

用这个就可以ExtractFilePath(Application.Exename);

下次提问题时写清楚。
 
对不起

要指定存在的某一个目录 不一定是当前运行目录 我要在那儿保存文件
 
选取目录吗?

SelectDirectory????可以不?
 
Chdir('E:/temp');
 
放一个SAVEDIALOG控件吧
 
还是不明白了,你倒出来啊,楼主
 
把你的问题写详细些好吗?
 
放一个SaveDialog控件!

SaveDialog1.Filter:=所有文件(*.*)|*.*;';//定义文件类型
SaveDialog1.FileName:=datetostr(now())+'data.mdb' ;//这里定义文件名
SaveDialog1.InitialDir:='c:/temp';//这里就是定义目录的
if SaveDialog1.Execute then
begin
//在这里进行保存文件的处理!
end;
 
The SetCurrentDirectory function changes the current directory for the current process.

BOOL SetCurrentDirectory(

LPCTSTR lpPathName // address of name of new current directory
);


Parameters

lpPathName

Points to a null-terminated string that specifies the path to the new current directory. This parameter may be a relative path or a fully qualified path. In either case, the fully qualified path of the specified directory is calculated and stored as the current directory.



Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Each process has a single current directory made up of two parts:

?A disk designator that is either a drive letter followed by a colon, or a server name and share name (//servername/sharename)
?A directory on the disk designator



See Also

GetCurrentDirectory
 
放一个directorylistbox1.Directory这个控件,用这个属性值就能确定了
 
ChDir(Edit1.Text);
if IOResult <> 0 then
MessageDlg('Cannot find directory', mtWarning, [mbOk], 0);
 
多人接受答案了。
 
后退
顶部