大家进来帮我看看这些错在哪里啊???(50分)

  • 主题发起人 主题发起人 haifeilong1
  • 开始时间 开始时间
H

haifeilong1

Unregistered / Unconfirmed
GUEST, unregistred user!
begin
try
copyfile('d:/OCX/ctCheck.ocx', 'c:/winnt/system32',false);
copyfile('d:/OCX/ctDEdit.ocx', 'c:/winnt/system32',false);
copyfile('d:/OCX/ctGrid.ocx', 'c:/winnt/system32',false);
copyfile('d:/OCX/ctRadio.ocx', 'c:/winnt/system32',false);
copyfile('d:/OCX/ctToolBar.ocx', 'c:/winnt/system32',false);}
showmessage('success');
except
showmessage('failure');
end;
end;

各位看看我的这些代码错在哪里啊?为什么运行完后都没有得到想要的结果,文件没有复制到相应的位置啊,请各位帮忙看看啊。。。我想把源地址的文件复制到c:/winnt/system32
下面,可是执行完后都没有复制过去,是怎么回事啊?
改成
begin
try
copyfile('d:/OCX/ctCheck.ocx', 'c:/winnt/system32',true);
copyfile('d:/OCX/ctDEdit.ocx', 'c:/winnt/system32',true);
copyfile('d:/OCX/ctGrid.ocx', 'c:/winnt/system32',true);
copyfile('d:/OCX/ctRadio.ocx', 'c:/winnt/system32',true);
copyfile('d:/OCX/ctToolBar.ocx', 'c:/winnt/system32',true);
showmessage('success');
except
showmessage('failure');
end;
end;
也还是不行,是不是我的函数用得有错误啊
大家快来看看啊。谢谢了/。。。。
 
copyfile('d:/OCX/ctCheck.ocx', 'c:/winnt/system32/',true);
 
不能是路径,是新的文件包括文件名
copyfile('d:/OCX/ctToolBar.ocx', 'c:/winnt/system32/ctToolBar.ocx',true);

BOOL CopyFile(

LPCTSTR lpExistingFileName, // pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);

Parameters
lpExistingFileName
Points to a null-terminated string that specifies the name of an existing file.
lpNewFileName
Points to a null-terminated string that specifies the name of the new file.

bFailIfExists
Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
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.
 
先查'd:/OCX/ctCheck.ocx'有没有这个文件?
 
同意zsy146的说法,带文件名就好了。
 
后退
顶部