Sfile:=dlgOpenPic1.FileName;
Nfile:=ExtractFilePath(Application.ExeName)+'DownLoadImg';
if not CopyFile(PWideChar(Sfile),PWideChar(Nfile),False)=True then
ShowMessage('error');以上语句复制文件,为什么不成功,总是ShowMessage('error')呢? Sfile:=AnsiString(dlgOpenPic1.FileName);
Nfile:=AnsiString(ApplicationPath+'DownLoadImg');
if not CopyFileA(PAnsiChar(Sfile),PAnsiChar(Nfile),False)=True then
ShowMessage('error');
换成这样也是一样的结果
Nfile:=ExtractFilePath(Application.ExeName)+'DownLoadImg';
if not CopyFile(PWideChar(Sfile),PWideChar(Nfile),False)=True then
ShowMessage('error');以上语句复制文件,为什么不成功,总是ShowMessage('error')呢? Sfile:=AnsiString(dlgOpenPic1.FileName);
Nfile:=AnsiString(ApplicationPath+'DownLoadImg');
if not CopyFileA(PAnsiChar(Sfile),PAnsiChar(Nfile),False)=True then
ShowMessage('error');
换成这样也是一样的结果
解决方案 »
- 修改系统年份,关闭恢复时间 【高手进】 delphi时间类
- 对象释放问题
- 求助:ADOQuery导出到xls,怎么自动把 1-1-1 给我转成2001-1-1这样的日期格式啦?
- 请问怎样设置Canvas的字体啊?
- 请教一个简单问题 急!!!(100分)
- 替我们市场总监发的欲觅技术总监/资深经理/项目经理/系统分析员/系统设计员/程序员(测试员就不要来了)的征友启事★★★★★
- Drate(小虫)进来领分,非常感谢,不过我只能给你这么多分了!
- 请问文件关联以后,双击文件自动打开程序,在程序中如何获得这个文件的路径,和如何判断我是通过关联文件打开这个程序的?
- 请教: 如何汉化 Delphi6.0?
- 各位高手,ADOQUERY控件的COMMANDTIMEOUT如何设置?????此属性不可用普通方法改变。
- ReportMachine怎么导出PDF啊?
- record赋值问题
if not CopyFileA(PAnsiChar(Sfile),PAnsiChar(Nfile),False)=True then
改成
if CopyFileA(PAnsiChar(Sfile),PAnsiChar(Nfile),False)=False then
var
Sfile, Nfile, ApplicationPath: string;
begin
if dlgOpenPic1.Execute then
begin
ApplicationPath := ExtractFilePath(Application.ExeName);
Sfile := (dlgOpenPic1.FileName);
Nfile := (ApplicationPath + 'DownLoadImg');
if CopyFile(pchar(Sfile), pchar(Nfile), false) = False then
ShowMessage('error');
end;
end;
if not CopyFile(PWideChar(Sfile),PWideChar(Nfile),False)=True then改成如下:
if CopyFile(PWideChar(Sfile),PWideChar(Nfile),true)=True then
这样就可以了。
另外:你的文件名没有扩展名啊?