本文整理自网络,侵删。
错误的:path1 := ExtractFilePath(application.ExeName)+'\databack'; if DirectoryExists(path1) then begin OpenDialog1.InitialDir:=path1; end; OpenDialog1.Execute;正确的:
path1 := ExtractFilePath(application.ExeName)+'databack'; if DirectoryExists(path1) then begin OpenDialog1.InitialDir:=path1; end; OpenDialog1.Execute;//设置属性之后弹出选择文件框判断路径是否存在都正确,问题就出在ExtractFilePath 本身就带路径后的斜杠,如:c:\nihao\,加上"\databack",就是c:\nihao\\databack这个时候设置就没有作用了,去掉那个斜杠就正确了,还是得按规范来。。。
相关阅读 >>
Delphi中indy10 的idtcpserver断开客户端连接报错问题的解决办法
Delphi getprocesshandleasname 获取进程句柄
更多相关阅读请进入《Delphi》频道 >>