关于利用API完成文件拷贝功能的一些问题
我要完成拷贝文件的功能,代码如下:(在USES 加入shellapi单元)
procedure TForm1.Button1Click(Sender: TObject);
var
F:TShFileOpStruct;
begin
F.Wnd:=Handle;
F.wFunc:=FO-COPY;
F.pForm:='c:\demo.txt';
F.pTo:='d:\test2.txt';
F.fFlags:=FOF-ALLOWUNDO OR FOF-RENAMEONCOLLISION;
if ShFileOperation(F)<>0 then
ShowMessage('文件拷贝失败!');
end;
报错如下:
[Error] Unit1.pas(31): Undeclared identifier: 'FO'
[Error] Unit1.pas(32): Undeclared identifier: 'pForm'
[Error] Unit1.pas(32): Incompatible types
[Error] Unit1.pas(34): Undeclared identifier: 'FOF'
[Error] Unit1.pas(34): Undeclared identifier: 'RENAMEONCOLLISION'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
怎么回事呢?